Ask about the nginx configuration 404 error page

Source: Internet
Author: User
The configuration is as follows: after {code...} takes effect, the following webpage dev. comu. php prompts: Filenotfound.dev.comabc.html returns the specified error page. How can this problem be solved? The configuration is as follows:

error_page   400 401 402 403 404  /40x.html;location = /40x.html {    root /Library/WebServer/public_html/dev/;}

After the modification takes effect, visit the following webpage

  • Http://dev.com/u.php prompt: File not found.
  • The http://dev.com/abc.html returns the specified error page

What is the problem? How can this problem be solved?

Reply content:

The configuration is as follows:

error_page   400 401 402 403 404  /40x.html;location = /40x.html {    root /Library/WebServer/public_html/dev/;}

After the modification takes effect, visit the following webpage

  • Http://dev.com/u.php prompt: File not found.
  • The http://dev.com/abc.html returns the specified error page

What is the problem? How can this problem be solved?

(1) Check fastcgi in the server moduleInterceptWhether errors is enabled or not.

fastcgi_intercept_errors on;

(2) check whether the location matches the 40x root directory with the 404 page and the permission configuration.
(3) Whether to reload or restart the nginx server after the configuration is complete
(4) nginx itself cannot parse php, so you need to use the fastcgi proxy to parse the php file for fpm. If I don't write the specific configuration, google will do it.
(5) The php script error may be a 50x error, which is not defined in your error_page.

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.