default.conf 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. server {
  2. listen 80;
  3. listen [::]:80;
  4. server_name _;
  5. root /usr/share/nginx/html;
  6. index index.html;
  7. client_max_body_size 500m;
  8. client_body_timeout 3600s;
  9. access_log /var/log/nginx/access.log;
  10. error_log /var/log/nginx/error.log;
  11. location = /health {
  12. proxy_pass http://backend:8111/health;
  13. proxy_http_version 1.1;
  14. proxy_set_header Host $host;
  15. proxy_connect_timeout 10s;
  16. proxy_read_timeout 30s;
  17. }
  18. location ^~ /docs {
  19. proxy_pass http://backend:8111;
  20. proxy_http_version 1.1;
  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. }
  26. location = /openapi.json {
  27. proxy_pass http://backend:8111/openapi.json;
  28. proxy_http_version 1.1;
  29. proxy_set_header Host $host;
  30. }
  31. # 附件上传:大文件要等正文传完再落存储,不能跟普通接口共用 120s
  32. location ^~ /api/web/admin/attachment/upload {
  33. proxy_pass http://backend:8111;
  34. proxy_http_version 1.1;
  35. proxy_set_header Host $host;
  36. proxy_set_header X-Real-IP $remote_addr;
  37. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  38. proxy_set_header X-Forwarded-Proto $scheme;
  39. proxy_request_buffering off;
  40. proxy_connect_timeout 60s;
  41. proxy_send_timeout 3600s;
  42. proxy_read_timeout 3600s;
  43. }
  44. location ^~ /api/ {
  45. proxy_pass http://backend:8111;
  46. proxy_http_version 1.1;
  47. proxy_set_header Host $host;
  48. proxy_set_header X-Real-IP $remote_addr;
  49. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  50. proxy_set_header X-Forwarded-Proto $scheme;
  51. proxy_connect_timeout 10s;
  52. proxy_send_timeout 120s;
  53. proxy_read_timeout 120s;
  54. }
  55. location ^~ /minio/zkxw/ {
  56. proxy_pass http://minio:9000/zkxw/;
  57. proxy_http_version 1.1;
  58. # 预签名 URL 按 MINIO_ENDPOINT(minio:9000)签名,Host 须与签名一致
  59. proxy_set_header Host minio:9000;
  60. proxy_set_header X-Real-IP $remote_addr;
  61. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  62. proxy_set_header X-Forwarded-Proto $scheme;
  63. proxy_request_buffering off;
  64. proxy_buffering off;
  65. proxy_read_timeout 600s;
  66. proxy_send_timeout 600s;
  67. proxy_connect_timeout 10s;
  68. add_header Access-Control-Allow-Origin * always;
  69. add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
  70. add_header Access-Control-Allow-Headers "DNT,User-Agent,Keep-Alive,Content-Type,Authorization,Range,If-Modified-Since,Cache-Control" always;
  71. if ($request_method = OPTIONS) {
  72. add_header Content-Length 0;
  73. add_header Content-Type text/plain;
  74. return 204;
  75. }
  76. }
  77. # OA H5(mobile-oa-h5,vite base=/oa-h5/)
  78. location = /oa-h5 {
  79. return 301 /oa-h5/;
  80. }
  81. location ^~ /oa-h5/ {
  82. root /usr/share/nginx/html;
  83. try_files $uri $uri/ /oa-h5/index.html;
  84. add_header Cache-Control "no-cache" always;
  85. }
  86. location / {
  87. try_files $uri $uri/ /index.html;
  88. }
  89. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
  90. expires 30d;
  91. add_header Cache-Control "public, immutable" always;
  92. add_header X-Content-Type-Options nosniff always;
  93. access_log off;
  94. }
  95. location ~* \.html$ {
  96. add_header Cache-Control "no-cache, no-store, must-revalidate" always;
  97. add_header Pragma "no-cache" always;
  98. add_header Expires "0" always;
  99. }
  100. location ~ /\. {
  101. deny all;
  102. access_log off;
  103. log_not_found off;
  104. }
  105. }