[结贴]在Nginx下访问CI目录出现404错误,请高手支招
在Nginx下运行CI时,发生错误,我已经按照坛里的贴子做了相应的调整,但还是不行,一访问CI目录就会出现404错误!截图如下:
http://lh4.ggpht.com/_A3GJRLlul4k/SXVDCBqOlpI/AAAAAAAAAWE/8OS2JsF3g_8/%E5%9C%A8Nginx%E4%B8%8B%E8%AE%BF%E9%97%AECI%E7%9B%AE%E5%BD%95%E5%87%BA%E7%8E%B0404%E9%94%99%E8%AF%AF.jpeg
注意:这里的404错误页面为CI自带的404而面。
我想应该还是规则没有写对,我已经翻阅了nginx文档,但还是不太明白,希望这里的高手指点一下,谢谢!
============================分割线===================================================
以下Nginx的配置:
server {
listen 80;
server_name localhost;
root /opt/www;
autoindex on;
index index.html index.htm index.php default.html default.htm default.php;
client_max_body_size 10M;
access_log /opt/nginx/logs/localhost.access.log main;
location /Nginx {
#stub_status on;
access_log off;
auth_basic "Nginx状态信息";
}
location ~ .*\.(php|php5)?$ {
fastcgi_pass 127.0.0.1:9000;
include /opt/nginx/conf/fastcgi_params;
}
if (-d $request_filename) {
rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;
}
#处理错误文件
error_page 404 /404.html;
location = /404.html {
root /opt/www;
charset on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /opt/www;
charset on;
}
#配置虚拟目录
location ^~/www {
index index.html index.htm index.php default.html default.htm default.php;
alias /cygdrive/d/wwwroot;
charset utf-8;
autoindex on;
}
#配置CI
location /CI_1.70/ {
if (-f $request_filename) {
expires max;
break;
}
if (!-e $request_filename) {
rewrite ^/CI_1.70/(.*)$ /CI_1.70/index.php/$1 last;
}
}
location /CI_1.70/index.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /opt/www/CI_1.70/index.php;
include /opt/nginx/conf/fastcgi_params;
}
}
===================================分割线============================================
CI配置为:
$config['base_url'] = "http://localhost/CI_1.70/";
$config['uri_protocol'] = "REQUEST_URI";
====================================解决办法======================================
将目录名中的“.”(点)号去掉即可
在此特别感谢漫无目的和沈鑫无私帮助
[ 本帖最后由 analyzer 于 2009-1-20 11:22 编辑 ] beyondbobo 发表于 2012-6-14 17:51
结毛贴啊,我的还没好,我直接是nginx 弹出的404
一样 ci的 config配置没的? $config['base_url'] CI已经配置过了,可还是不行 我的 nginx 只是配置成一个代理,所有处理都由 apache 完成,所以没遇到这样的问题,呵呵。 把CI_1.70换成CI_17呢?目录也是
回复 6楼 的帖子
感谢你,漫漫,太好了!!!我得请你喝酒! 不错哦,我抄楼主的,也成功了,就是不理解是什么意思。我$config['uri_protocol'] = "PATH_INFO";
结毛贴啊,我的还没好,我直接是nginx 弹出的404 一样也没有搞定
页:
[1]
2