| |
| |
|
|
| upstream socar_backend { |
| server socar-ai-system:8000; |
| keepalive 32; |
| } |
|
|
| |
| server { |
| listen 80; |
| listen [::]:80; |
| server_name _; |
|
|
| |
| location /.well-known/acme-challenge/ { |
| root /var/www/certbot; |
| } |
|
|
| |
| location / { |
| return 301 https://$host$request_uri; |
| } |
| } |
|
|
| |
| server { |
| listen 443 ssl http2; |
| listen [::]:443 ssl http2; |
| server_name _; |
|
|
| |
| |
| ssl_certificate /etc/nginx/ssl/fullchain.pem; |
| ssl_certificate_key /etc/nginx/ssl/privkey.pem; |
|
|
| |
| ssl_protocols TLSv1.2 TLSv1.3; |
| ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384; |
| ssl_prefer_server_ciphers off; |
|
|
| |
| ssl_session_timeout 1d; |
| ssl_session_cache shared:SSL:50m; |
| ssl_session_tickets off; |
|
|
| |
| ssl_stapling on; |
| ssl_stapling_verify on; |
| resolver 8.8.8.8 8.8.4.4 valid=300s; |
| resolver_timeout 5s; |
|
|
| |
| add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always; |
| 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 "strict-origin-when-cross-origin" always; |
| add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self' data:; connect-src 'self' https:;" always; |
|
|
| |
| access_log /var/log/nginx/socar_access.log; |
| error_log /var/log/nginx/socar_error.log; |
|
|
| |
| client_max_body_size 100M; |
| client_body_buffer_size 10M; |
|
|
| |
| location / { |
| proxy_pass http://socar_backend; |
| proxy_http_version 1.1; |
| proxy_set_header Upgrade $http_upgrade; |
| proxy_set_header Connection 'upgrade'; |
| 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_set_header X-Forwarded-Host $host; |
| proxy_set_header X-Forwarded-Port $server_port; |
| proxy_cache_bypass $http_upgrade; |
|
|
| |
| proxy_connect_timeout 60s; |
| proxy_send_timeout 120s; |
| proxy_read_timeout 120s; |
| } |
|
|
| |
| location /static/ { |
| proxy_pass http://socar_backend; |
| proxy_cache_valid 200 1d; |
| add_header Cache-Control "public, max-age=86400"; |
| } |
|
|
| |
| location /health { |
| proxy_pass http://socar_backend; |
| proxy_cache_bypass 1; |
| add_header Cache-Control "no-cache, no-store, must-revalidate"; |
| } |
| } |
|
|