refactor: update nginx configuration for improved caching and clarity
This commit is contained in:
@@ -1,19 +1,33 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
|
||||||
# Przekieruj /odoo (bez slash) na /odoo/ (z slash)
|
# Przekierowanie bez / na /odoo/
|
||||||
location = /odoo {
|
location = /odoo {
|
||||||
return 301 /odoo/;
|
return 301 /odoo/;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Serwowanie plików Vue pod /odoo/
|
# Serwowanie Vue
|
||||||
location /odoo/ {
|
location /odoo/ {
|
||||||
alias /usr/share/nginx/html/;
|
alias /usr/share/nginx/html/;
|
||||||
index index.html;
|
index index.html;
|
||||||
try_files $uri $uri/ /odoo/index.html;
|
try_files $uri $uri/ /odoo/index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Proxy do backendu (niewidoczny z zewnątrz)
|
# 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/ {
|
location /odoo/api/ {
|
||||||
proxy_pass http://backend:8000/;
|
proxy_pass http://backend:8000/;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
@@ -22,3 +36,4 @@ server {
|
|||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user