server { listen 80 default_server; server_name www.caipudq.cn caipudq.cn *.caipudq.cn;
root /mnt/www/tp5caipu/public;
location / { index index.php index.html index.htm; if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=/$1 last; break; } } location ~ \.php { root /mnt/www/tp5caipu/public; access_log /var/log/nginx/caipudq/access.log; #access_log属于ngx_http_log_module的设置,缺省level为info
error_log /var/log/nginx/caipudq/error.log; #error_log属于core module, 缺省的level是error index index.php index.html index.htm; #由于是PHP类型的动态页面为主,所以把index.php放在前面效率会更高些 fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; try_files $uri $uri/ /index.php?$args; #普通php网站因为没有rewrite的话,这个不需要 } include fastcgi_params; error_page 404 /404.html; location = /40x.html { }
error_page 500 502 503 504 /50x.html; location = /50x.html { }
}
转载于:https://www.cnblogs.com/mengzhilva/p/11439292.html