Files
2026-09-30 10:37:27 -04:00

62 lines
1.7 KiB
Nginx Configuration File

# =============================================================================
# Nginx config for AI Growth Technologies SPA
# Serves the built Vite assets with BrowserRouter fallback + gzip + caching
# =============================================================================
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_proxied any;
gzip_comp_level 6;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/xml+rss
image/svg+xml
font/woff
font/woff2;
# Long-cache hashed Vite assets
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
access_log off;
try_files $uri =404;
}
# Static assets (favicon, llms.txt, robots, sitemap)
location ~* \.(?:ico|png|jpg|jpeg|webp|svg|css|js|woff2?|txt|xml|map)$ {
expires 30d;
add_header Cache-Control "public";
access_log off;
try_files $uri =404;
}
# SPA fallback: serve index.html for all client-side routes
location / {
try_files $uri $uri/ /index.html;
}
# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header X-XSS-Protection "1; mode=block" always;
# Custom error pages fall back to SPA
error_page 404 /index.html;
}