From 94e0cedd63c958cd1c36f0c23a60988c18466f20 Mon Sep 17 00:00:00 2001 From: JuLi0n21 Date: Sun, 22 Sep 2024 14:29:26 +0200 Subject: [PATCH] add nginx.conf --- frontend/Dockerfile | 2 +- frontend/nginx.conf | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 frontend/nginx.conf diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 4953b1f..664e475 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -14,7 +14,7 @@ RUN npm run build-only FROM nginx:alpine COPY --from=builder /app/dist /usr/share/nginx/html - +COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] diff --git a/frontend/nginx.conf b/frontend/nginx.conf new file mode 100644 index 0000000..4d532e0 --- /dev/null +++ b/frontend/nginx.conf @@ -0,0 +1,18 @@ +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + + try_files $uri $uri/ /index.html; # Redirect all non-static routes to index.html + } + + error_page 404 /index.html; + + location = /index.html { + root /usr/share/nginx/html; + } +} +