CodeIgniter nginx 404

时间:2023-03-09 06:03:35
CodeIgniter nginx  404

默认情况下CI 不支持路由模式需要在server里面配置,配置成如下即可:

server
{
listen 80 ;
server_name wechat.XX.com.cn;
root XX;
index index.html index.php;
location ~ \.php($|/) { fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
} if (!-e $request_filename) {
rewrite "^/(.*)$" /index.php last;
break;
} location /status {
stub_status on;
access_log off;
} location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
} location ~ .*\.(js|css)?$
{
expires 12h;
} access_log /home/wwwlogs/XX/access.log access; }

  如此配置下就可以用了