chore: update Dockerfile to use custom nginx.conf
This commit is contained in:
parent
49ca18ca6b
commit
153a8c635d
@ -38,8 +38,8 @@ FROM nginx:alpine
|
||||
# Copy static files from build stage
|
||||
COPY --from=builder /app/web-app/dist-web /usr/share/nginx/html
|
||||
|
||||
# Copy nginx configuration for SPA (if custom config is needed)
|
||||
# COPY nginx.conf /etc/nginx/nginx.conf
|
||||
# Copy custom nginx config
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
22
nginx.conf
Normal file
22
nginx.conf
Normal file
@ -0,0 +1,22 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Handle routes with or without trailing slash
|
||||
location / {
|
||||
try_files $uri $uri/ $uri.html $uri/index.html /index.html;
|
||||
}
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
|
||||
# Cache static assets
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user