default.conf 3.7 KB

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