HTTP directives

error_page directive (HTTP)

HTTP core; http/server/location/if in location; no default. Selects error handling; optional override or handler-derived status. URI redirection changes non-GET/HEAD methods to GET; named location avoids that change. Inherited only when no error_page is defined at the current level.

Formal Syntax & Structure

nginx syntaxnginx
error_page code ... [=[response]] uri;

Parameters & Attributes

NameTypeDescription
codeintegerOne or more error statuses.
responseintegerOptional replacement status after =.
uristringError target URI, named location or redirect URL.

Working Example

Example Snippetnginx
error_page 404 /errors/404.html;
Nginx Reference