用nginx下安装CI程序,实现rewiteurl例子
好久没有来CI了,看见nginx讨论中有很多人在nginx下不会部署CI程序,实现url优化(去掉index.php),好吧,我已经在nginx使用CI有一段时间了,就来部署吧这是nginx其中一个server的配置
server
{
listen 82;
server_name_;##这个“_”其实没有什么,你也可以填*,它其实是一个域名的访问匹配正则
index index.html index.htm index.php;
root/wwwroot;
location ~ /(images|css|js|swf|upload|kindeditor)/.*$
{
}
location ~ .*\.(txt|ico)$
{
}
location ~ .*$
{
rewrite /.* /index.php break;
fastcgi_pass127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
access_log off;
}
在CI中config.php设置如下就可了,
$config['base_url'] = '';
$config['index_page'] = '';
另外注意是,要将82这个端口在防火墙中打开,重启nginx就可以了
不错,谢谢:D 采用楼主的配置,解决了No input file specified.
但现在一直显示404 Page Not Found
项目本身的配置文件还需要哪里配置么
本地测试(mac+nginx) ok
服务器 (linux+nginx) ng cn.soft 发表于 2013-5-16 09:27 static/image/common/back.gif
采用楼主的配置,解决了No input file specified.
但现在一直显示404 Page Not Found
项目本身的配置文件还 ...
如果出现404是很容易打问题了,这是说这页不存在,你可以打开nginx访问日志,在日志中找到查找文件路径,对比下该路径是否有这个文件就能解决问题
我一般这样:
try_files $uri $uri/ /index.php
页:
[1]