Common articles on the Internet are added to the server section in the nginx virtual host configuration file:
The code is as follows: |
Copy code |
Error_page 404 =/404.html; |
This is not the case. I will find it and find the method.
The code is as follows: |
Copy code |
Fastcgi_intercept_errors on; |
Change nginx. conf (or a separate website configuration file, for example, the site configuration file under nginx-> sites-enabled)
In the server area Add: error_page 404 =/404.html or error_page 404 = http://www.xxxx.xxx/404.htm
After reload is complete, the/etc/init. d/nginx reload will be OK, so that the error 404 page will appear normally.
You must add: fastcgi_intercept_errors on. If this token is not set, neither 404.html nor error_page is created.
Effective. Fastcgi_intercept_errors syntax: fastcgi_intercept_errors on | off default: fastcgi_intercept_errors
Off: http, server, and location. By default, nginx does not support custom 404 error pages. Only this command is set to on,
Nginx supports 404 error redirection. Note that if fastcgi_intercept_errors on is set, nginx will set the 404
Error redirection. In nginx, the 404 error redirection takes effect only when fastcgi_intercept_errors on is set and
Error_page option (including syntax and corresponding 404 page)