nginx 支持pathinfo

错误描述:1,打开网页,页面提示不支持pathinfo
                 2,类似 index.php/hellworld 会提示找不到页面
解决办法:1,修改nginx.conf的server{} 中的内容下:
           
75         # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
76         #
77         location ~ \.php {
78             root           html;
79             fastcgi_pass   127.0.0.1:9000;
80             fastcgi_index  index.php;
81             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
82             include        fastcgi_params;
83         #pathinfo support
84             set $real_script_name $fastcgi_script_name;
85             set $path_info "";
86             if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$"){
87                 set $real_script_name $1;
88                 set $path_info $2;
89             }
90
91             fastcgi_param SCRIPT_NAME $real_script_name;
92             fastcgi_param PATH_INFO $path_info;
93              
94         }


ps:红色部分为 笔者改动的部分

猜你喜欢

转载自chen498402552-163-com.iteye.com/blog/1213757