February 2018
Beginner to intermediate
348 pages
9h 40m
English
Detailed in the module directives of the Nginx HTTP Core module, error_page allows you to define the server behavior when a specific error code occurs. The simplest form is to affect a URI to an error code:
server {
server_name website.com;
error_page 403 /errors/forbidden.html;
error_page 404 /errors/not_found.html;
}
When a client attempts to access a URI that triggers one of these errors (such as loading a document or file that does not exist on the server, resulting in a 404 error), Nginx is supposed to serve the page associated to the error code. In fact, it does not just send the client the error page; it actually initiates a completely new request, based on the new URI.
Consequently, you can end up falling back on a different ...