Recently just learned CI framework, did a simple project, in the local server environment has been tuned, but when deployed to the remote server:
http://example.com/(index.php)/accessible (default controller-class for configuration)
http://example.com/(index.php)/[controller-class]/[controller-method] can not be accessed (prompt for 404 Error!) )
Finally Baidu Reason:
For/INDEX.PHP/ABC this url,apache and lighttpd will be interpreted as "index.php?abc", and Nginx will consider it to be an ABC file under the directory where the name "index.php" is requested. the content. So CI under nginx does not configure rewrite is not operational, and in Apache and Lighttpd is normal.
Solution (point Bold, focus red ):
1server {2Listen 80;3server_name example.com;4root/data/wwwroot/example/5Index index.php index.html Index.htm;67Location ~* \. (Css|js|swf|htm|jpg|png|gif|json|atlas)?$ {8expires 1d;9Add_header Pragma Public;TenAdd_header Cache-control "Public"; One } A -Location/Controller-class/ { -if(!-E$request _filename) { theRewrite ^/Controller-class/(.*)$ /Controller-class/index.php?q=$uri&$args; - } - } - +Location ~ \.php$ { -Fastcgi_pass 127.0.0.1:9000; +Fastcgi_index index.php; AFastcgi_param Script_filename$document _root$fastcgi_script_name; atFastcgi_param Php_value open_basedir=$document _root:/tmp/:/proc/; -includeFastcgi_params; - } - -}
Reference: http://www.2cto.com/os/201301/185926.html "Nginx+ci 404 Error Problem"
The above describes the Nginx+ci 404 errors, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.