codeigniter在nginx下返回404 not found
codeigniter框架需要path_info的支持,Apache默认支持path_info,但是nginx默认不支持,我们需要设置nginx,使得nginx支持path_info
网上试了好多方法最总才解决希望对大家有所帮助:(我的mac版的,具体设置看你们的需要,把重点的红色显示)
server {
listen 8080;
server_name localhost;
location / {
# root /usr/local/var/www/;
# index index.html index.htm index.php;
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^(.*)$ /wechat/index.php?$1 last;
break;
# rewrite ^/(.*)$ /wechat/index.php/$1 last;
# break; 注意:网上好多是用 index.php/$1 应该是 ? 这个要注意了
}
}
# error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/var/www;
}
location ~ \.php$ {
root /usr/local/var/www;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
rewrite or internal redirection cycle while processing "/wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php//wechat/index.php/server", client: 127.0.0.1, server: localhost, request: "GET /wechat/index.php/server HTTP/1.1", host: "127.0.0.1:8080"
rewrite 重复了10次 并不是 break 的问题
这个问题就是上面说的 / 改为 ? 即可。
codeigniter在nginx下返回404 not found的更多相关文章
- codeigniter(ci)在nginx下返回404的处理方法即codeigniter在nginx下配置方法
codeigniter(ci)在nginx下返回404的处理方法即codeigniter在nginx下配置方法 进入nginx的配置文件 加上一句(本来就有这句,只需要修改一下就行了) locatio ...
- CodeIgniter框架——nginx下的配置
odeigniter(CI)是一个轻量型的PHP优秀框架,但是它是在apache服务器下开发的,在nginx下需要特别的配置才可以使用. 对nginx的配置如下: server { listen 80 ...
- NGINX下配置404错误页面的方法分享
NGINX下配置自定义的404页面是可行的,而且很简单,只需如下几步,需要的朋友可以参考下 1. 创建自己的404.html页面 2.更改nginx.conf在http定义区域加入: fastcg ...
- codeigniter在nginx 下支持pathinfo和去除index.php的方法
as今天准备把网站搬迁到nginx上发现codeigniter框架在nginx上不能使用,后来发现是nginx不支持pathinfo,下面介绍怎么在nginx下开启pathinfo 开始pathinf ...
- CodeIgniter在nginx下404 not found
server { listen ; server_name test.platform; charset utf8; root /data/www/platform/trunk; location / ...
- nginx下配置404错误页面
1.创建自己的404.html页面,并放于网站根目录. 2.更改nginx.conf在http定义区域加入: fastcgi_intercept_errors on; 3.更改nginx.conf(或 ...
- tp5在apache下能访问,但放到nginx下报404
index index.php index.html index.htm; if ( -f $request_filename) { break; } if ( !-e $request_filena ...
- nginx history路由模式时,页面返回404重定向index.html
1.路由默认是带#的,有时我们感觉不美观,就使其变为history模式,也就没有#字符 2.# 如果找不到当前页面(404),就返回index.html,重新分配路由 location ^~/prod ...
- 记录一次 Nginx 配置 proxy_pass 后 返回404问题
一. Nginx 配置 proxy_pass 后 返回404问题 故障解决和定位 1.1. 问题 在一次生产涉及多次转发的配置中, 需求是下面的图: 在配置好了 proxy_pass 之后,请求 ww ...
随机推荐
- mybatis 学习总结笔记Day2
在门外听到或看到一门技术,找资料入门,一看,嗯,不错,进门之后,发现,尼玛————,是片海,你是关门而出,还是学习精卫填海. 填海吧,也许只是个小水坑,稍加用点力,就填的7788了. 上一篇随笔中说了 ...
- JAVA创建子进程并处理waitFor() 阻塞问题
虽然很想休息,但是想想还是要把今天学的东西记下来,不然以后再用还是新知识. 新建一个线程类读取子进程的汇报信息和错误信息,避免阻塞 class StreamGobbler extends Thread ...
- Java 层序创建和遍历二叉树
直接上代码 package te.com; import java.util.LinkedList; import java.util.Queue; import java.util.logging. ...
- Linux中apt与apt-get命令的区别与解释
2019-01-15 14:35:39 随着 apt install package 命令的使用频率和普遍性逐步超过 apt-get install package,越来越多的其它 Linux 发行版 ...
- Redhat 5.7 安装 glibc debuginfo ,终于成功。
1) yum --enablerepo rhel-debuginfo install glibc-debuginfo 安装完之后,yum list 可以看出debuginfo 是 build 123, ...
- 非常好的 gdb tui 的文章
http://beej.us/guide/bggdb/ Help Commands help command Get help on a certain command apropos keyword ...
- ionic this.navCtrl.push()和this.navCtrl.pop()
在ionic中,this.navCtrl.push()和this.navCtrl.pop()都是进行页面跳转,但是用法又有区别 例如有A B C三个页面,三个页面都是使用this.navCtrl. ...
- 20170906xlVBA_RecursionGetFiles
Dim Dic As Object Sub GetFileName() Dim FolderPath As String Set Dic = CreateObject("Scripting. ...
- Northcott Game HDU - 1730
Tom和Jerry正在玩一种Northcott游戏,可是Tom老是输,因此他怀疑这个游戏是不是有某种必胜策略,郁闷的Tom现在向你求救了,你能帮帮他么? 游戏规则是这样的: 如图所示,游戏在一个n行m ...
- 牛客练习赛41 B-666RPG
题目链接:https://ac.nowcoder.com/acm/contest/373/B 题意:有n个回合,每个回合给1个数,每个回合你有两种选择 1.加上第i个数 2.将当前数乘-1 想知道有多 ...