Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

398 resolve nginx 404 #292

Merged
merged 2 commits into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions static-html/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN cd ${STATIC_HTML_DIR} && \

FROM nginx:1.13.12-alpine

ENV NGINX_404_REDIR_TARGET='$scheme://$host/404.html'
ENV STATIC_HTML_PORT=80

COPY --from=static-builder /html/ /usr/share/nginx/html/
Expand Down
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