# Nginx configuration for vscode.mnemo-cards.online # Generated by generate-nginx-configs.sh on Thu Nov 27 22:57:44 MSK 2025 # Service: vscode server { listen 80; server_name vscode.mnemo-cards.online; return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name vscode.mnemo-cards.online; # SSL configuration ssl_certificate /etc/letsencrypt/live/mnemo-cards.online/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/mnemo-cards.online/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers HIGH:!aNULL:!MD5; # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-XSS-Protection "1; mode=block" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "no-referrer-when-downgrade" always; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; # VSCode Server specific settings client_max_body_size 100M; # Static files - no rate limiting location ~ ^/(static|out|node_modules)/ { proxy_pass http://127.0.0.1:8443; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_cache_valid 200 1h; add_header Cache-Control "public, max-age=3600"; proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; } # Static file extensions - no rate limiting location ~ \.(js|css|woff|woff2|ttf|eot|png|jpg|jpeg|gif|svg|ico|webp|map|json)$ { proxy_pass http://127.0.0.1:8443; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_cache_valid 200 1h; add_header Cache-Control "public, max-age=3600"; proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; } # Main proxy location location / { proxy_pass http://127.0.0.1:8443; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; proxy_buffering off; proxy_request_buffering off; } # Security - deny access to hidden files location ~ /\. { deny all; } }