ai.api.conf 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. upstream myapi {
  2. ip_hash;
  3. server 127.0.0.1:48080;
  4. }
  5. server {
  6. listen 80;
  7. server_name ai.api.daoguyujia.com;
  8. client_max_body_size 500M;
  9. location ^~ /.well-known/acme-challenge/ {
  10. root /home/webroot;
  11. allow all;
  12. }
  13. location / {
  14. proxy_pass http://myapi;
  15. proxy_http_version 1.1;
  16. proxy_connect_timeout 4s;
  17. proxy_read_timeout 60s;
  18. proxy_send_timeout 12s;
  19. proxy_set_header Upgrade $http_upgrade;
  20. proxy_set_header Connection "upgrade";
  21. proxy_set_header X-Real-IP $remote_addr;
  22. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  23. proxy_set_header Host $http_host;
  24. proxy_set_header X-NginX-Proxy true;
  25. proxy_redirect off;
  26. }
  27. # 接口开放监听 (SSE)
  28. location /api/sse/ {
  29. proxy_pass http://myapi/api/sse/;
  30. proxy_http_version 1.1;
  31. proxy_set_header Upgrade $http_upgrade;
  32. proxy_set_header Connection "upgrade";
  33. proxy_read_timeout 10s;
  34. proxy_send_timeout 10s;
  35. proxy_buffering off;
  36. proxy_cache off;
  37. proxy_set_header Connection "";
  38. }
  39. }
  40. server {
  41. listen 443 ssl;
  42. server_name ai.api.daoguyujia.com;
  43. ssl_certificate /root/.acme.sh/ai.api.daoguyujia.com/fullchain.cer;
  44. ssl_certificate_key /root/.acme.sh/ai.api.daoguyujia.com/ai.api.daoguyujia.com.key;
  45. ssl_session_cache shared:SSL:1m;
  46. ssl_session_timeout 5m;
  47. ssl_ciphers HIGH:!aNULL:!MD5;
  48. ssl_prefer_server_ciphers on;
  49. location / {
  50. proxy_pass http://myapi;
  51. proxy_http_version 1.1;
  52. proxy_connect_timeout 4s;
  53. proxy_read_timeout 60s;
  54. proxy_send_timeout 12s;
  55. proxy_set_header Upgrade $http_upgrade;
  56. proxy_set_header Connection "upgrade";
  57. proxy_set_header X-Real-IP $remote_addr;
  58. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  59. proxy_set_header Host $http_host;
  60. proxy_set_header X-NginX-Proxy true;
  61. proxy_redirect off;
  62. }
  63. # 接口开放监听 (SSE)
  64. location /api/sse/ {
  65. proxy_pass http://myapi/api/sse/;
  66. proxy_http_version 1.1;
  67. proxy_set_header Upgrade $http_upgrade;
  68. proxy_set_header Connection "upgrade";
  69. proxy_read_timeout 10s;
  70. proxy_send_timeout 10s;
  71. proxy_buffering off;
  72. proxy_cache off;
  73. proxy_set_header Connection "";
  74. }
  75. }