Skip to content

Commit

Permalink
fix(nginx): redirect 404 requests home
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislavbebej committed Jan 5, 2024
1 parent 94dd446 commit a65a537
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ RUN mkdir /ejks \
# Runtime container
FROM nginx:1.25.3-alpine-slim

# Replace default configuration
COPY nginx-default-server.conf /etc/nginx/conf.d/default.conf

# Add application
COPY --from=builder /ejks /usr/share/nginx/html
COPY src/favicon.ico src/googlee78c4ec223f14545.html /usr/share/nginx/html/
Expand Down
19 changes: 19 additions & 0 deletions nginx-default-server.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
server {
listen 80;
listen [::]:80;
server_name localhost;

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

error_page 404 =200 /index.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

0 comments on commit a65a537

Please sign in to comment.