Skip to content

Commit

Permalink
fix(dockerfile): support SPA refresh to resolve nginx return 404 (#384)
Browse files Browse the repository at this point in the history
* feat(dockerfile): support SPA refresh to resolve nginx return 404

* remove comments & set server_name to default

---------

Co-authored-by: Guy Ben-Aharon <guybenah@gmail.com>
  • Loading branch information
xieyuanbin1 and guyb1 authored Nov 14, 2024
1 parent fe8b9f9 commit eaf75ce
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ RUN npm run build
FROM nginx:stable-alpine AS production

COPY --from=builder /usr/src/app/dist /usr/share/nginx/html
COPY ./default.conf /etc/nginx/conf.d/default.conf

# Expose the default port for the Nginx web server
EXPOSE 80
Expand Down
15 changes: 15 additions & 0 deletions default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server {
listen 80;
listen [::]:80;

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

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

0 comments on commit eaf75ce

Please sign in to comment.