Nginx + CI error 404 and nginxci404. Nginx + CI error 404, nginxci404 error recently I just learned the ci framework and made a simple project. all the local server-building environments were called, but when I deployed them to a remote server: http: Nginx + CI 404 error, nginxci404 error
Recently I just learned the ci framework and made a simple project. all the local server-building environments have been called, but when I deploy it to a remote server:
Http://example.com/(index. php)/accessible (for the default controller-class configured)
Http://example.com/(index. php)/[controller-class]/[controller-method] inaccessible (error 404 !)
Baidu:
For URLs such as/index. php/abc, Apache and Lighttpd press "index. php? Nginx considers the content of the abc file under the "index. php" directory as the request name. Therefore, CI cannot run without configuring rewrite in nginx, but is normal in Apache and Lighttpd.Solution (Key Points Plus
Rough, Highlighted in red ):
1 server { 2 listen 80; 3 server_name example.com; 4 root /data/wwwroot/example/ 5 index index.php index.html index.htm; 6 7 location ~* \.(css|js|swf|htm|jpg|png|gif|json|atlas)?$ { 8 expires 1d; 9 add_header Pragma public;10 add_header Cache-Control "public";11 }12 13 location /controller-class/ {14 if (!-e $request_filename) {15 rewrite ^/controller-class/(.*)$ /controller-class/index.php?q=$uri&$args;16 }17 }18 19 location ~ \.php$ {20 fastcgi_pass 127.0.0.1:9000;21 fastcgi_index index.php;22 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;23 fastcgi_param PHP_VALUE open_basedir=$document_root:/tmp/:/proc/;24 include fastcgi_params;25 }26 27 }
Reference: http://www.2cto.com/ OS /201301/185926.html?nginx=ci40404incorrect question]
Recently, I just learned the ci framework and made a simple project. I can call all the local server-building environments, but when I deploy it on a remote server: http :...