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. Exactly how to set it? Let's 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;
Copy Code code as follows:
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;
Copy Code code as follows:
Error_page 404 =/404.html;
The third step is to restart the LNMP;
Copy Code code as follows:
To summarize, we can test the return status by/usr/local/nginx/sbin/nginx-t.
Copy Code code as follows:
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.