Skip to content

Instantly share code, notes, and snippets.

@ejangi
Created June 7, 2015 01:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ejangi/bae9a5ba5c5c91a06d94 to your computer and use it in GitHub Desktop.
Save ejangi/bae9a5ba5c5c91a06d94 to your computer and use it in GitHub Desktop.
NGINX Custom Error Pages
http {
...
server {
...
error_page 401 @401;
location @401 {
root /srv/www/error-documents/public;
try_files /401.html =401;
}
error_page 403 @403;
location @403 {
root /srv/www/error-documents/public;
try_files /403.html =403;
}
error_page 404 @404;
location @404 {
root /srv/www/error-documents/public;
try_files /404.html =404;
}
error_page 408 @408;
location @408 {
root /srv/www/error-documents/public;
try_files /408.html =408;
}
error_page 500 @500;
location @500 {
root /srv/www/error-documents/public;
try_files /500.html =500;
}
error_page 502 @502;
location @502 {
root /srv/www/error-documents/public;
try_files /502.html =502;
}
error_page 503 @503;
location @503 {
root /srv/www/error-documents/public;
try_files /503.html =503;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment