|
在Nginx下运行CI时,发生错误,我已经按照坛里的贴子做了相应的调整,但还是不行,一访问CI目录就会出现404错误!
截图如下:
注意:这里的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 编辑 ] |
|