feat: Add Nginx configuration for SPA routing and static asset caching.
Build & Push Hospitality / build-and-push (push) Successful in 3m43s
Build & Push Hospitality / build-and-push (push) Successful in 3m43s
This commit is contained in:
@@ -22,5 +22,8 @@ WORKDIR /usr/share/nginx/html
|
|||||||
# Legg inn bygget frontend
|
# Legg inn bygget frontend
|
||||||
COPY --from=build /app/dist .
|
COPY --from=build /app/dist .
|
||||||
|
|
||||||
|
# Kopier custom nginx config for SPA routing
|
||||||
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
|
||||||
# Nginx server som statisk side
|
# Nginx server som statisk side
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
# Support for SPA routing
|
||||||
|
location / {
|
||||||
|
try_files $uri $uri/ /index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Optional: Cache static assets
|
||||||
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, no-transform";
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user