Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐:
搜索:
您的位置: Linux安全网 > Linux培训 > » 正文

nginx 支持pathinfo

来源: 未知 分享至:
错误描述:1,打开网页,页面提示不支持pathinfo
2,类似 index.php/hellworld 会提示找不到页面
解决办法:1,修改nginx.conf的server{} 中的内容下:

138 server {
139 listen 8080;
140 server_name 180.153.97.67 60.29.236.243;
141 #charset koi8-r;
142
143 #access_log logs/host.access.log main;
144
145 location / {
146 root html/ome_test;
147 index index.html index.htm index.php;
148 }
149
150 #error_page 404 /404.html;
151
152 # redirect server error pages to the static page /50x.html
153 #
154 error_page 500 502 503 504 /50x.html;
155 location = /50x.html {
156 root html;
157 }
158
159 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
160 #
161 #location ~ \.php$ {
162 # proxy_pass http://127.0.0.1;
163 #}
164
165 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
166 #
167 location ~ \.php {
168 root html/ome_test;
169 fastcgi_pass 127.0.0.1:9000;
170 fastcgi_index index.php;
171 set $real_script_name $fastcgi_script_name;
172 set $path_info "";
173 if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$"){
174 set $real_script_name $1;
175 set $path_info $2;
176 }
177 fastcgi_param SCRIPT_NAME $real_script_name;
178 fastcgi_param PATH_INFO $path_info
179 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_na me;
180
181 include fastcgi_params;
182 }
183
184 # deny access to .htaccess files, if Apache's document root
185 # concurs with nginx's one
186 #
187 #location ~ /\.ht {
188 # deny all;
189 #}
190 }

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

Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史