server { listen 80; server_name your-domain.com; # Absolute path to your dist directory root /path/to/your/dist; index index.html; # Debug logging - helps identify which files can't be found error_log /var/log/nginx/app-error.log debug; access_log /var/log/nginx/app-access.log; # Default MIME types include /etc/nginx/mime.types; # Very important: Set default type to prevent fallback to text/plain default_type application/octet-stream; # Handle JavaScript files specifically location ~* \.js$ { add_header Content-Type application/javascript; } # Handle module script requests location ~* \.(mjs|js)$ { add_header Content-Type application/javascript; } # Basic SPA configuration location / { try_files $uri $uri/ /index.html; } }