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.