Tutorial on setting up a Web 404 error page under LNMP

Source: Internet
Author: User
Tags html page
First, modify the nginx.conf file

The code is as follows Copy Code

/usr/local/nginx/conf

Locate the nginx.conf file in the directory file above. Then add a row to the HTTP section:

The code is as follows Copy Code

Fastcgi_intercept_errors on;

Second, modify the website. conf file

The code is as follows Copy Code

/usr/local/nginx/conf/vhost

In the above directory, and then find the site that corresponds to the 404 page where you want to modify the settings. conf config file, such as "laobuluo.com.conf"

The code is as follows Copy Code

Error_page 404/404.html;

Add the previous line of script to the server section. We're going to be ready in advance 404. The HTML page is placed in the root directory of the Web site, but it can be matched anyway.

Third, restart Nginx effective

The code is as follows Copy Code

LNMP Nginx Reload

The new LNMP environment Nginx used is the above script, the previous version slightly different.

In this way, the 404 pages that we set up can take effect.

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.