# Example nginx configuration for reverse proxy # Copy this file to your nginx sites-available directory and modify as needed # Example: /etc/nginx/sites-available/chess-tutor upstream chess_tutor { server localhost:3050; keepalive 64; } server { listen 80; listen [::]:80; server_name your-domain.com www.your-domain.com; # Redirect HTTP to HTTPS (uncomment when SSL is configured) # return 301 https://$server_name$request_uri; # If not using HTTPS, use this location block instead: location / { proxy_pass http://chess_tutor; 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_cache_bypass $http_upgrade; # Timeouts proxy_connect_timeout 60s; proxy_send_timeout 60s; proxy_read_timeout 60s; } # Gzip compression gzip on; gzip_vary on; gzip_min_length 1024; gzip_proxied any; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript; gzip_disable "MSIE [1-6]\."; } # HTTPS configuration (uncomment and configure when you have SSL certificates) # server { # listen 443 ssl http2; # listen [::]:443 ssl http2; # server_name your-domain.com www.your-domain.com; # # # SSL certificate paths (use Let's Encrypt or your own certificates) # ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem; # ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem; # # # SSL configuration # ssl_protocols TLSv1.2 TLSv1.3; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # ssl_session_cache shared:SSL:10m; # ssl_session_timeout 10m; # # # Security headers # add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" 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; # # location / { # proxy_pass http://chess_tutor; # 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_cache_bypass $http_upgrade; # # # Timeouts # proxy_connect_timeout 60s; # proxy_send_timeout 60s; # proxy_read_timeout 60s; # } # # # Gzip compression # gzip on; # gzip_vary on; # gzip_min_length 1024; # gzip_proxied any; # gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript; # gzip_disable "MSIE [1-6]\."; # # # Rate limiting (optional but recommended) # # limit_req_zone $binary_remote_addr zone=chess_tutor_limit:10m rate=10r/s; # # limit_req zone=chess_tutor_limit burst=20 nodelay; # }