39 lines
1.3 KiB
Nginx Configuration File
39 lines
1.3 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
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;
|
|
}
|
|
|
|
# Static asset caching
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|vtt|txt)$ {
|
|
expires 30d;
|
|
add_header Cache-Control "public, no-transform";
|
|
}
|
|
}
|