nginx不支持pathinfo模式解决方法

错误描述:1,打开网页,页面提示不支持pathinfo
                 2,类似 index.php/hellworld 会提示找不到页面
解决办法:1,修改nginx.conf的server{} 中的内容下:
            备注: 如果是在vhost配置下可单独添加在vhost配置文件下,如果没有vhost则在nginx.conf配置文件下添加
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         }

posted @ 2015-01-08 11:46  stoneryan  阅读(428)  评论(0编辑  收藏  举报