Focus on cloud service provider activities
Notes on website operation and maintenance

LNMP series tutorial 6: setting 404 error page

Shared to in previous articles“ How to set 301 redirection "In the article, if 301 is mentioned, it must also be mentioned four hundred and four Error page. Because we have installed by default LNMP after four hundred and four The page will not be set automatically, nor will it default to the 404 error page of the program, but we need to set it manually. How to set it? Let's look down together.

Step 1: edit the/usr/local/nginx/conf/nginx.conf file, and add the following code in the http area;

fastcgi_intercept_errors on;

 LNMP series tutorial 6: setting 404 error page

Step 2, edit the conf file of the website you need to add 404 pages, and add the code in the server area in usr/local/nginx/conf/vhost/;

error_page 404 = /404.html;

Step 3: Restart LNMP;

/root/lnmp restart

In conclusion, we can test whether the returned status is correct through/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 the above return status is true, it is correct.


Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » LNMP series tutorial 6: setting 404 error page

Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge