server { listen 80; listen [::]:80; server_name ai.qpid.pro; location /.well-known/acme-challenge/ { root /var/www/certbot; } # Game Configurator & Admin Panel SPA location /configurator/ { alias /usr/share/nginx/html/configurator_work/; index index.html; try_files $uri $uri/ /configurator/index.html; } location / { return 301 https://$host$request_uri; } } server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name ai.qpid.pro; ssl_certificate /etc/letsencrypt/live/ai.qpid.pro/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/ai.qpid.pro/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers HIGH:!aNULL:!MD5; ssl_session_cache shared:SSL:10m; ssl_session_timeout 1d; root /usr/share/nginx/html; index index.html; # Security Headers 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 "no-referrer-when-downgrade" always; # Certbot webroot location /.well-known/acme-challenge/ { root /var/www/certbot; } # All Game Backend APIs (Auth, Leaderboard, Campaign, Bugs, Config, Admin, Users) location /api/ { proxy_pass http://127.0.0.1:8001; 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; } # Gitea Git Service proxy location = /gitea { return 301 https://$host/gitea/; } location /gitea/ { proxy_pass http://127.0.0.1:3000/; 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 Connection ""; proxy_buffering off; proxy_read_timeout 120s; proxy_connect_timeout 5s; client_max_body_size 100M; } # SPA Fallback & Static asset serving # Game Configurator & Admin Panel SPA location /configurator/ { alias /usr/share/nginx/html/configurator_work/; index index.html; try_files $uri $uri/ /configurator/index.html; } location / { try_files $uri $uri/ /index.html; } }