fix: update Nginx configuration and Dockerfile paths for Vue application
This commit is contained in:
@@ -8,7 +8,7 @@ RUN npm run build
|
||||
|
||||
# Etap 2: Nginx serwujący Vue + proxy do backendu
|
||||
FROM nginx:alpine
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY --from=build /app/dist /usr/share/nginx/html/odoo
|
||||
|
||||
# Konfiguracja Nginx z proxy
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
@@ -1,32 +1,13 @@
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Przekierowanie bez / na /odoo/
|
||||
location = /odoo {
|
||||
return 301 /odoo/;
|
||||
}
|
||||
|
||||
# Serwowanie Vue
|
||||
location /odoo/ {
|
||||
alias /usr/share/nginx/html/;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /odoo/index.html;
|
||||
}
|
||||
|
||||
# no cache index.html
|
||||
location = /odoo/index.html {
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
expires 0;
|
||||
}
|
||||
|
||||
# cache JS/CSS/OBRAZY na długo
|
||||
location ~* \.(?:js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
access_log off;
|
||||
expires 1y;
|
||||
alias /usr/share/nginx/html/;
|
||||
}
|
||||
|
||||
# Proxy do backendu
|
||||
location /odoo/api/ {
|
||||
proxy_pass http://backend:8000/;
|
||||
@@ -35,5 +16,23 @@ server {
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Serwowanie Vue
|
||||
location /odoo/ {
|
||||
try_files $uri $uri/ /odoo/index.html;
|
||||
}
|
||||
|
||||
# Ustawienia cache dla assetów
|
||||
location ~* /odoo/.*\.(?:js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||
access_log off;
|
||||
expires 1y;
|
||||
}
|
||||
|
||||
# Brak cache'owania dla pliku index.html
|
||||
location = /odoo/index.html {
|
||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||
expires 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user