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 ...
随机推荐
- HDU 1715 斐波那契数列1000项
二维数组模拟大数加法就可以了,不太难,直接上代码了. #include<stdio.h> #include<string.h> #include<math.h> # ...
- 插件写法之脚本运行环境,mac和window检测
(function(root, factroy){ /* * 在这里进行对脚本运行环境的检测判断 * 浏览器中 有window对象 * node.js服务器端 有Global对象 * * IE11 ...
- vue init webpack nameXXX 报错问题:
vue新建demo项目报错如下: M:\lhhVueTest>vue init webpack L21_VueProject vue-cli · Failed to download repo ...
- h5 audio进度条
h5 audio 播放进度条 效果图: html部分: <div class="audiojindu"> <div class="playcontrol ...
- python中configparser模块的使用
configparser模块用于生成和修改常见配置文档,当前模块的名称在 python 3.x 版本中变更为 configparser. 首先要写一个如下所示的配置文件: [DEFAULT] serv ...
- ultragrid
foreach (UltraGridColumn aCol in this.ultraGrid1.DisplayLayout.Bands[0].Columns){this.ultraGrid1.Dis ...
- 雷林鹏分享:C# 基本语法
C# 基本语法 C# 是一种面向对象的编程语言.在面向对象的程序设计方法中,程序由各种相互交互的对象组成.相同种类的对象通常具有相同的类型,或者说,是在相同的 class 中. 例如,以 Rectan ...
- LeetCode--443--压缩字符串(未看)
问题描述: 给定一组字符,使用原地算法将其压缩. 压缩后的长度必须始终小于或等于原数组长度. 数组的每个元素应该是长度为1 的字符(不是 int 整数类型). 在完成原地修改输入数组后,返回数组的新长 ...
- 20180831xlVBA_WorksheetsCosolidate
Sub WorkSheetsConsolidate() Rem 设置求和区域为 单元格区域;单元格区域 Const Setting As String = "A1;B2:C4" D ...
- 20170706xlVBA批量提取word表格中的自我评分
单位里普遍存在各种低效率的办公行为,比如每年的自我评分.评分细目表为word文档,每行一个项目,每个项目要填写得分事项和分值,组长审核之后转成Excel向上递交.主要涉及到问题就是word文档中一列得 ...