Skip to content

Instantly share code, notes, and snippets.

@tom--
Created August 16, 2022 13:23
Show Gist options
  • Save tom--/04e15c3e877c78da7d1ba50b527710e2 to your computer and use it in GitHub Desktop.
Save tom--/04e15c3e877c78da7d1ba50b527710e2 to your computer and use it in GitHub Desktop.
# this vhost config sends my custom 404 page on not-found errors. but the `return 503` causes nginx
# to send its own built-in error page. why is that? how to change this config so it sends my 503.html?
server {
listen 80;
server_name tarfu.example.com;
root /var/www/v2/doc_root/web;
if ($maintenance = 1) {
return 503;
}
error_page 400 /error_pages/400.html;
error_page 403 /error_pages/403.html;
error_page 404 /error_pages/404.html;
error_page 503 /error_pages/503.html;
error_page 500 501 502 504 /error_pages/500.html;
location ^~ /error_pages/ {
root /var/www;
internal;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment