LNMP Configure the appropriate error page in Nginx error_page

Source: Internet
Author: User

1. Create your own 404.html page

2. Change nginx.conf in the HTTP definition area: fastcgi_intercept_errors on;

3. Change the nginx.conf (or a separate site profile, such as a site profile under Nginx-sites-enabled)

In the server zone join: error_page 404 =/404.html or error_page 404 = http://www.xxx.com/404.html

4. After the change to restart Nginx, test nginx.conf correctness:/opt/nginx/sbin/nginx–t

Errors such as #502 can be configured in the same way.

Error_page 502 503 504 =/50x.html;


1, if it is Error_page 404/404.html, this although set the redirect page, but the return error code is still the original error code 404

2, Error_page 404=200/404.html, this redirect page will return the new setting error code 200

LNMP Configure the appropriate error page in Nginx 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.