Where does nginx
store the default error pages it outputs on disk? I.E. the standard 404
looking like:
404 Not Found
Hopefully these are not hard-coded into the nginx source. Thanks.
Creating Your Custom Error Pages Put your custom error pages in the /usr/share/nginx/html directory where Nginx sets its default document root.
conf under /etc/nginx/snippets/ as shown. This configuration causes an internal redirect to the URI/error-page. html every time NGINX encounters any of the specified HTTP errors 404, 403, 500, and 503. The location context tells NGINX where to find your error page.
Every NGINX configuration file will be found in the /etc/nginx/ directory, with the main configuration file located in /etc/nginx/nginx. conf .
Check out html folder in the nginx directory - there should be 50x pages.
By default, I believe, all "special pages", including 404 page are hardcoded
static char ngx_http_error_404_page[] =
"<html>" CRLF
"<head><title>404 Not Found</title></head>" CRLF
"<body>" CRLF
"<center><h1>404 Not Found</h1></center>" CRLF
;
Source: https://github.com/nginx/nginx/blob/release-1.15.8/src/http/ngx_http_special_response.c#L132
but can be customized:
server {
...
error_page 404 /404.html;
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With