(编辑:jimmy 日期: 2024/12/28 浏览:2)
最近刚学ci框架,做了个简单的项目,在本地搭服务器的环境都调通了,但是部署到远程服务器时:
http://example.com/(index.php)/ 可以访问(为配置的默认controller-class)
http://example.com/(index.php)/[controller-class]/[controller-method] 不可以访问(提示404错误!)
最后百度原因:
对于/index.php/abc这种url,Apache和Lighttpd会按”index.php"codetitle">复制代码 代码如下:
server {
listen ;
server_name example.com;
root /data/wwwroot/example/ index index.php index.html index.htm;
location ~* \.(css|js|swf|htm|jpg|png|gif|json|atlas)"public";
}
location /controller-class/ {
if (!-e $request_filename) {
rewrite ^/controller-class/(.*)$ /controller-class/index.php?q=$uri&$args;
}
}
location ~ \.php$ {
fastcgi_pass ...:;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE open_basedir=$document_root:/tmp/:/proc/;
include fastcgi_params;
}
}
以上内容是小编给大家分享的Nginx+CI出现404错误怎么解决的相关内容,希望对大家有所帮助!