Lnmp setting 404 error page

Source: Internet
Author: User

Lnmp is the Web architecture of Linux + nginx + MySQL + PHP.

1. In the website's root directory touch file 404.html, the content is as follows:

<HTML>

<Body>

</Html>

2. cHmod 755 404.html

Chown www: www 404.html

3. Modify the nginx configuration file nginx. conf:

Add fastcgi_intercept_errors on in the HTTP {} region;

Add error_page 404/404 .html in server;

4. Restart nginx web server.

5. Enter the wrong address in the IE Address Bar and the Error 404 page will be returned. Shown as follows:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/42/FF/wKioL1PZCZnjsfHKAADDYK9rsUg690.jpg "Title =" lnmp404error page .jpg "alt =" wkiol1pzcznjsfhkaaddyk9rsug690.jpg "/>


6. The error_page command is used to set the URI address returned to the client if a specified HTTP Error status code is displayed.

7. Configure the error_page command, for example:

Error_page 404/404 .html;

If the page responding to the error code is a FastCGI program such as PHP, it is best to add the = sign in error_page.

Error_page 404 =/404.php;

If you want to return the original error status code, remove the = in the error_page command.

Error_page 404/404 .php;

 


This article from the "Lin Xi" blog, please be sure to keep this source http://lutaoxu.blog.51cto.com/4224602/1532999

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.