# ============================================================================= # MOPC Platform - Nginx Reverse Proxy Configuration # ============================================================================= # Setup steps: # 1. sudo ln -s /opt/mopc/docker/nginx/mopc-platform.conf /etc/nginx/sites-enabled/ # 2. sudo nginx -t && sudo systemctl reload nginx # 3. sudo certbot --nginx -d portal.monaco-opc.com # # Certbot will automatically add SSL configuration to this file. # Rate limiting zone limit_req_zone $binary_remote_addr zone=mopc_limit:10m rate=10r/s; server { listen 80; listen [::]:80; server_name portal.monaco-opc.com; # 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 "strict-origin-when-cross-origin" always; # File upload size (500MB for videos) client_max_body_size 500M; # Rate limiting limit_req zone=mopc_limit burst=20 nodelay; # Logging access_log /var/log/nginx/mopc-access.log; error_log /var/log/nginx/mopc-error.log; # Next.js application location / { proxy_pass http://127.0.0.1:7600; 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 for large file uploads proxy_connect_timeout 300s; proxy_send_timeout 300s; proxy_read_timeout 300s; } # Static files caching location /_next/static { proxy_pass http://127.0.0.1:7600; proxy_cache_valid 200 365d; add_header Cache-Control "public, max-age=31536000, immutable"; } # Health check endpoint (no access log noise) location /api/health { proxy_pass http://127.0.0.1:7600; access_log off; } }