
server {
listen 80;
server_name 域名;
index index.html index.htm index.php;
root 项目目录;
location ~* ^/(application|Thinkphp|Uploads)/.*\.(php|php5)$ #此处根据项目实际情况处理
{
deny all;
}
#此处根据项目是否启用rewrite规则来决定是否要开启
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php/$1& last;}
location ~ .*\.php($|/)
{
fastcgi_pass unix:/tmp/php-cgi-56.sock; #此处根据php-fpm.conf中,listen的配置值设置
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$; #增加这一句
fastcgi_param PATH_INFO $fastcgi_path_info; #增加这一句
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #增加这一句
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
error_log /wwwlog/etpc/error.log crit;
access_log /wwwlog/etpc/access.log main;
} 文章来源: tp3.2+nginx支持path_info
人吐槽 | 人点赞 |
发表评论