add nginx.conf for frontend

This commit is contained in:
tuanvu
2026-02-12 10:56:08 +01:00
parent 1c3ee99b74
commit 20d83ffafe
3 changed files with 73 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ RUN npx ng build
FROM nginx:alpine
COPY --from=build /app/dist/tlcfront /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

View File

@@ -0,0 +1,20 @@
server {
location /api/polls {
proxy_pass http://back:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html?$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}