server { listen 804; server_name localhost; root /usr/share/nginx/html; index index.html; # Security headers add_header X-Frame-Options "SAMEORIGIN"; add_header X-XSS-Protection "1; mode=block"; add_header X-Content-Type-Options "nosniff"; add_header Strict-Transport-Security "max-age=31536000"; add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://unpkg.com; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; media-src 'self';"; # Compression gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; location / { try_files $uri $uri/ /index.html; expires 1h; add_header Cache-Control "public, no-transform"; } # Video files handling location /videos/ { alias /usr/share/nginx/html/videos/; add_header Cache-Control "public, no-transform"; types { video/mp4 mp4; } add_header Accept-Ranges bytes; } # Images handling location /images/ { alias /usr/share/nginx/html/images/; add_header Cache-Control "public, no-transform"; types { image/png png; image/jpeg jpg jpeg; image/svg+xml svg; } } # Subtitles handling location /subtitles/ { alias /usr/share/nginx/html/subtitles/; add_header Cache-Control "public, no-transform"; types { text/vtt vtt; } } # Transcriptions handling location /transcriptions/ { alias /usr/share/nginx/html/transcriptions/; add_header Cache-Control "public, no-transform"; types { text/plain txt; } } # Static asset caching location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|vtt|txt)$ { expires 30d; add_header Cache-Control "public, no-transform"; } }