fix: Add nginx SPA routing config
All checks were successful
Deploy Development / deploy (push) Successful in 33s
All checks were successful
Deploy Development / deploy (push) Successful in 33s
This commit is contained in:
parent
b1c5999f6e
commit
e4d052f182
|
|
@ -25,8 +25,8 @@ FROM nginx:alpine
|
||||||
# Copy built app
|
# Copy built app
|
||||||
COPY --from=build /app/dist /usr/share/nginx/html
|
COPY --from=build /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
# Copy nginx config (if exists)
|
# Copy nginx config for SPA routing
|
||||||
# COPY nginx.conf /etc/nginx/nginx.conf
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|
|
||||||
17
frontend/nginx.conf
Normal file
17
frontend/nginx.conf
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# SPA routing - serve index.html for all routes
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cache static assets
|
||||||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, immutable";
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user