Last active
April 15, 2020 22:49
-
-
Save irgendwr/3565384de91efcc6592ceed8a9c6ab3d to your computer and use it in GitHub Desktop.
Nginx snippet for custom error pages that searches the root first and falls back to a default location.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error_page 400 /400.html; | |
error_page 401 /401.html; | |
error_page 403 /403.html; | |
error_page 404 /404.html; | |
error_page 500 /500.html; | |
error_page 501 /501.html; | |
error_page 502 /502.html; | |
error_page 503 /503.html; | |
error_page 520 /520.html; | |
error_page 521 /521.html; | |
error_page 533 /533.html; | |
location ~* ^/(400|401|403|404|500|501|502|503|520|521|533)\.html$ { | |
try_files $uri @error; | |
} | |
# default error pages | |
location @error { | |
root /var/www/error; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment