Skip to content

Commit

Permalink
override nginx 404 as static page with redirect target
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Martin authored and jaredgalanis committed Dec 5, 2022
1 parent bf309d2 commit 010934c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions static-html/nginx-template.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ server {
#charset utf-8;
#access_log /var/log/nginx/host.access.log main;

# error page handler:
error_page 404 = @pass404redirect;

# redirect to top-level 404:
location @pass404redirect {
return 302 ${NGINX_404_REDIR_TARGET} ;
}

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
Expand Down

0 comments on commit 010934c

Please sign in to comment.