first commit
This commit is contained in:
70
frontend/nginx.conf
Normal file
70
frontend/nginx.conf
Normal file
@@ -0,0 +1,70 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# URL puliti — /mappa trova mappa.html
|
||||
location / {
|
||||
try_files $uri $uri.html $uri/ =404;
|
||||
}
|
||||
|
||||
# Pagine "scheda" con slug nel path: /<page>/<slug> -> <page>.html
|
||||
# Lo slug resta leggibile lato client da location.pathname.
|
||||
# Elencare qui le pagine path-style reali quando esistono (deve esistere il relativo .html).
|
||||
# Esempio:
|
||||
# location ~ ^/(?<page>artifact|institution)/[^/]+/?$ {
|
||||
# try_files /$page.html =404;
|
||||
# }
|
||||
|
||||
# Proxy per API: inoltra /api/* al backend
|
||||
location /api/ {
|
||||
proxy_pass http://backend:8000/api/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Documentazione utente (MkDocs)
|
||||
location /documentation/ {
|
||||
proxy_pass http://docs:8000/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Documentazione OpenAPI (Scramble) — /api-docs/* → backend /docs/*
|
||||
location /api-docs/ {
|
||||
rewrite ^/api-docs/(.*)$ /docs/$1 break;
|
||||
proxy_pass http://backend:8000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# Cache aggressiva per asset con hash (Vite li genera con hash nel nome)
|
||||
location ~* \.(js|css|woff2|png|jpg|ico|svg)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Blocca file sensibili
|
||||
location ~ /\. {
|
||||
deny all;
|
||||
}
|
||||
|
||||
# Storage per file statici
|
||||
location /storage/ {
|
||||
alias /usr/share/nginx/html/storage/;
|
||||
access_log off;
|
||||
expires 30d;
|
||||
}
|
||||
|
||||
access_log /dev/stdout;
|
||||
error_log /dev/stderr warn;
|
||||
}
|
||||
Reference in New Issue
Block a user