default.conf 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. server {
  2. listen 80;
  3. server_name match.dzhhzy.com;
  4. # Proxy settings
  5. location / {
  6. proxy_pass http://match-vote-nextjs-nextjs-1:3000; # 使用完整的容器名称
  7. proxy_http_version 1.1;
  8. proxy_set_header Upgrade $http_upgrade;
  9. proxy_set_header Connection 'upgrade';
  10. proxy_set_header Host $host;
  11. proxy_set_header X-Real-IP $remote_addr;
  12. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  13. proxy_set_header X-Forwarded-Proto $scheme;
  14. proxy_cache_bypass $http_upgrade;
  15. # 添加超时设置
  16. proxy_connect_timeout 60s;
  17. proxy_send_timeout 60s;
  18. proxy_read_timeout 60s;
  19. }
  20. location /uploads {
  21. alias /app/public/uploads;
  22. try_files $uri $uri/ =404;
  23. add_header X-Debug-Message "$document_root$uri" always;
  24. }
  25. # 添加健康检查路由
  26. location /health {
  27. access_log off;
  28. return 200 'OK';
  29. }
  30. # Security headers
  31. add_header X-Frame-Options "SAMEORIGIN" always;
  32. add_header X-XSS-Protection "1; mode=block" always;
  33. add_header X-Content-Type-Options "nosniff" always;
  34. add_header Referrer-Policy "no-referrer-when-downgrade" always;
  35. # Gzip compression
  36. gzip on;
  37. gzip_vary on;
  38. gzip_proxied any;
  39. gzip_comp_level 6;
  40. gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
  41. # 日志格式
  42. access_log /var/log/nginx/match.dzhhzy.com.access.log;
  43. error_log /var/log/nginx/match.dzhhzy.com.error.log;
  44. }