← Каталог
Nginx — конфиги под задачу — 3. SPA — fallback на index.html
Фрагмент из «Nginx — конфиги под задачу»: 3. SPA — fallback на index.html.
server {
listen 80;
server_name app.local;
root /var/www/spa/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(js|css|png|jpg|svg|woff2)$ {
expires 7d;
add_header Cache-Control "public, immutable";
}
} server {
listen 80;
server_name app.local;
root /var/www/spa/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location ~* \.(js|css|png|jpg|svg|woff2)$ {
expires 7d;
add_header Cache-Control "public, immutable";
}
}