1. Write an error.html page yourself
2. Change nginx.conf and add in http definition area: fastcgi_intercept_errors on;
3. Change nginx.conf and add in the server area: error_page 404 /404.html
4. Restart ngnix
In addition, if there is an error page on port 8000, it should also jump to the error page on port 80.
Add error_page 404 error under server 8000, and include error.conf
# the difference when adding URI to proxy_pass directive:
# http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass
# why I use variable but not staticlly config the url:
# http://forum.nginx.org/read.php?2,215830,215832#msg-215832
#
# and resolver is needed, or will get 502, ref:
# https://stackoverflow.com/questions/5743609/
#
# why use rewrite: http://wiki.nginx.org/HttpProxyModule#proxy_pass
resolver 127.0.0.1;
location /error {
proxy_pass http://127.0.0.1:80;
}
location /images {
proxy_pass http://127.0.0.1:80;
}
location /js {
proxy_pass http://127.0.0.1:80;
}
location /css {
proxy_pass http://127.0.0.1:80;
}