CI 在nginx中出现404错误的解决方式
因为你的nginx配置的是截取.php文件后缀的访问转发到PHP-CGI,而index.php和index.php/是不一样的。。 你在nginx里面写一句:
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
//出现的问题 用这个解决了,
NGINX 默认不支持 PATH_INFO 模式,需要修改NGINX配置 让NGINX 来解析 index.php/controller/f 这种模式 具体配置:
#CI
server {
listen 80;
server_name www.ci.com;
index index.php index.html index.htm;
root "/servers/apps/CI";
location ~ \.php{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
##########################################pathinfo 模式
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$"){
set $real_script_name $1;
set $path_info $2;
}
include fastcgi.conf;
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
##########################################nginx支持pathinfo 模式的重点
}
}
本文转载自: https://www.cnblogs.com/hubing/p/3984002.html 非常感谢这位开发者,解决了我的问题。
更多阅读
- 宇秀下拉 2024-6-14号下拉更新案例
- 利用python3 beautifulsoup4解析网页(一)
- centos 7 将自带的php5.4升级到php5.6(亲测成功)
- seo中apache、nginx、iis 三大web服务器环境的404怎么样的?怎么解决?看这一篇就够了
- 宇秀下拉 2022-8-3号下拉更新案例
- Vim变身IDE:易学易用功能强大的vim配置
- 宇秀下拉 2021-8-2号下拉更新案例
- 宇秀-搜索引擎下拉推荐营销系统7.04增加bing平台
- 网页404错误是什么意思,怎么解决
- Linux (gvim:6883): Gtk-WARNING **: Invalid input string错误解决

qq:1535604235


QQ
微信
商店