# NGINX configuration for network.ospab.host # Place this file in: /etc/nginx/sites-available/network.ospab.host # Enable with: sudo ln -s /etc/nginx/sites-available/network.ospab.host /etc/nginx/sites-enabled/ server { listen 80; listen [::]:80; server_name network.ospab.host; # Redirect all HTTP to HTTPS return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name network.ospab.host; # SSL Certificate (Let's Encrypt) ssl_certificate /etc/letsencrypt/live/network.ospab.host/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/network.ospab.host/privkey.pem; # SSL Configuration (Modern) ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384'; ssl_prefer_server_ciphers off; ssl_session_timeout 10m; ssl_session_tickets off; ssl_stapling on; ssl_stapling_verify on; # Security Headers add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; add_header Referrer-Policy "strict-origin-when-cross-origin" always; add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always; # Root directory (path to built site) root /var/www/network.ospab.host/dist; 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/json application/javascript application/xml+rss application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml; # Logging access_log /var/log/nginx/network.ospab.host.access.log; error_log /var/log/nginx/network.ospab.host.error.log; # Cache static assets location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff|woff2|ttf|eot)$ { expires 1y; add_header Cache-Control "public, immutable"; } # SPA fallback - serve index.html for all routes location / { try_files $uri $uri/ /index.html; } # Deny access to hidden files location ~ /\. { deny all; } }