default.conf 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. log_format custom_format '$remote_addr - $remote_user [$time_local] '
  2. '"$request" $uri $status $body_bytes_sent $request_time '
  3. '"$http_referer" "$http_user_agent" '
  4. 'request_id=$request_id user_id=$http_user_id';
  5. server {
  6. listen 80;
  7. server_name _;
  8. access_log /dev/stdout custom_format;
  9. keepalive_timeout 60s;
  10. client_header_timeout 60s;
  11. client_body_timeout 60s;
  12. send_timeout 10s;
  13. underscores_in_headers on;
  14. client_max_body_size 50m;
  15. client_body_buffer_size 5m;
  16. # proxy_max_temp_file_size 40960m;
  17. proxy_http_version 1.1;
  18. real_ip_header X-Real-IP;
  19. set_real_ip_from 127.0.0.1;
  20. set_real_ip_from unix:;
  21. proxy_set_header Host $host;
  22. proxy_set_header X-Real-IP $remote_addr;
  23. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  24. proxy_set_header X-Forwarded-Proto $scheme;
  25. proxy_set_header Connection ""; # 设置 Connection 为长连接
  26. proxy_cache off; # 关闭缓存
  27. proxy_buffering off; # 关闭代理缓冲
  28. chunked_transfer_encoding on; # 开启分块传输编码
  29. tcp_nopush on; # 开启 TCP NOPUSH 选项,禁止 Nagle 算法
  30. tcp_nodelay on; # 开启 TCP NODELAY 选项,禁止延迟 ACK 算法
  31. location / {
  32. proxy_pass http://adh-web:3000;
  33. }
  34. location /adh/ {
  35. proxy_pass http://adh-api:8880;
  36. # WebSocket support
  37. proxy_http_version 1.1;
  38. proxy_set_header Upgrade $http_upgrade;
  39. proxy_set_header Connection "upgrade";
  40. }
  41. }