server { listen 80; server_name www.ibangoo.com ibangoo.com; server_tokens on; #隐藏nginx服务器信息 提高服务器的安全 location / { root /usr/share/nginx/html/Ibangoo_Web/; index index.php index.html index.htm; if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; } } location ~ \.php$ { #匹配根目录下的所有的PHP文件 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/Ibangoo_Web$fastcgi_script_name; root /usr/share/nginx/html/Ibangoo_Web/; include fastcgi_params; } if ($host = 'ibangoo.com' ) { #如果域名不带www,跳转到带www目录下的 rewrite ^/(.*)$ http://www.Ibangoo.com/$1 permanent; } }
nginx文档
最新推荐文章于 2024-07-17 22:01:08 发布