LNMP Series Tutorial five: Set 404 error page

Source: Internet
Author: User

In the previous article to share the "Set 301 Redirect Method" article, mentioned 301, that must also say 404 error page. Because we installed the default LNMP 404 pages will not automatically set, and will not default to the program's 404 error page, but we need to manually set. How do you set it? We look down together.

The first step is to edit the/usr/local/nginx/conf/nginx.conf file and add the following code to the HTTP area;

Fastcgi_intercept_errors on;

The second step, edit you need to add 404 pages of the Web site conf file, corresponding to the usr/local/nginx/conf/vhost/xxxx.com.conf, in the server area to add code;

Error_page 404 =/404.html;

The third step is to restart the LNMP;

/ROOT/LNMP restart

To summarize, we can test the return status by/usr/local/nginx/sbin/nginx-t.

The configuration file/usr/local/nginx/conf/nginx.conf syntax is OK

Configuration file/usr/local/nginx/conf/nginx.conf test is successful

If this is the return state, it is correct.

This article fixed link: http://www.laozuo.org/215.html | Old Left Blog

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.