Shared to in previous articles“ How to set 301 redirection "The article, referring to 301, must also talk about the 404 error page. Because after we install LNMP by default, the 404 page will not be automatically set, 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;

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/XXXX.com.conf;
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.