Nginx+ci frame 404 Error How to solve _nginx

Source: Internet
Author: User

The CI framework was recently studied, and a simple project was made to connect to the local server environment, but when deployed to a remote server:

http://example.com/(index.php)/accessible (default controller-class for configuration)

http://example.com/(index.php)/[controller-class]/[controller-method] cannot be accessed (hint 404 error!) )

Last Baidu Reason:

For/index.php/abc such url,apache and lighttpd are interpreted as "index.php?abc" and Nginx is considered to be the content of the ABC file in the directory where the request name is "index.php". So CI is not configured under Nginx Rewrite is not able to run, while in Apache and Lighttpd is normal.

Solution (point bold, key red):

Copy Code code as follows:

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)? $ {
Expires D;
Add_header Pragma public;
Add_header Cache-control "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;
}
}

The above content is small make up to everyone to share the Nginx+ci 404 errors How to solve the relevant content, hope to help everyone!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.