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 ...
随机推荐
- art-template
art-template 输出 标准语法 {{value}} {{data.key}} {{data['key']}} {{a ? b : c}} {{a || b}} {{a + b}} 原始语法 ...
- 在nodejs中的集成虹软人脸识别
==虹软官网地址==http://www.arcsoft.com.cn 在官网注册账号,并且申请人脸识别激活码, 选择SDK版本和运行系统(windows/linux/android/ios) ,我们 ...
- vue.js环境配置步骤及npm run dev报错解决方案
安装完成后,使用npm run dev 运行,成功后,就可以在浏览器中看到vue的欢迎画面了 最后一步可能报错,我就遇到这样的问题了, 个人问题仅供参考: ERROR Failed to compil ...
- VNC安装配置
1,安装VNC yum install tigervnc-server -y2,设定密码: vncpasswd root 3,配置服务文件,下面是配置了6个窗口. cp /lib/systemd/sy ...
- 牛客国庆集训派对Day3 I Metropolis
Metropolis 思路: 多源点最短路 只要两个不同源点的最短路相遇,我们就更新两个源点的答案 代码: #pragma GCC optimize(2) #pragma GCC optimize(3 ...
- c# DataTable 序列化json
if (ds.Tables[0].Rows.Count != 0) { var list = GetJsonString(ds ...
- Linux中ulimit -c生成core文件()
理解这六个shell脚本语言的功能 echo "kernel.core_pattern = /tmp/core-%e-%p-%t" >> /etc/sysctl.con ...
- MySQL ICP(Index Condition Pushdown)特性
一.SQL的where条件提取规则 在ICP(Index Condition Pushdown,索引条件下推)特性之前,必须先搞明白根据何登成大神总结出一套放置于所有SQL语句而皆准的where查询条 ...
- 并查集-解决区间和纠错问题 hdu-3038
题目:多次给出信息,告诉你[a,b]区间的和,求多少个错误信息(错误信息不考虑). 乍一看有点像线段树,但想想就发现这个并不能用线段树方便地解决.后来经提醒是并查集的一种经典题型. 把区间抽象为并查集 ...
- Linux中常用压缩打包工具
Linux中常用压缩打包工具 压缩打包是常用的功能,在linux中目前常用的压缩工具有gzip,bzip2以及后起之秀xz.本文将介绍如下的工具常见压缩.解压缩工具以及打包工具tar. gzip2 直 ...