六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 56|回复: 0

nginx 支持pathinfo

[复制链接]

升级  17%

73

主题

73

主题

73

主题

举人

Rank: 3Rank: 3

积分
251
 楼主| 发表于 2013-2-4 13:28:03 | 显示全部楼层 |阅读模式
错误描述: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:红色部分为 笔者改动的部分
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表