default.conf 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. location ^~ /api/ {
  31. proxy_pass http://backend:8111;
  32. proxy_http_version 1.1;
  33. proxy_set_header Host $host;
  34. proxy_set_header X-Real-IP $remote_addr;
  35. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  36. proxy_set_header X-Forwarded-Proto $scheme;
  37. proxy_connect_timeout 10s;
  38. proxy_send_timeout 120s;
  39. proxy_read_timeout 120s;
  40. }
  41. location ^~ /minio/zkxw/ {
  42. proxy_pass http://minio:9000/zkxw/;
  43. proxy_http_version 1.1;
  44. # 预签名 URL 按 MINIO_ENDPOINT(minio:9000)签名,Host 须与签名一致
  45. proxy_set_header Host minio:9000;
  46. proxy_set_header X-Real-IP $remote_addr;
  47. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  48. proxy_set_header X-Forwarded-Proto $scheme;
  49. proxy_request_buffering off;
  50. proxy_buffering off;
  51. proxy_read_timeout 600s;
  52. proxy_send_timeout 600s;
  53. proxy_connect_timeout 10s;
  54. add_header Access-Control-Allow-Origin * always;
  55. add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
  56. add_header Access-Control-Allow-Headers "DNT,User-Agent,Keep-Alive,Content-Type,Authorization,Range,If-Modified-Since,Cache-Control" always;
  57. if ($request_method = OPTIONS) {
  58. add_header Content-Length 0;
  59. add_header Content-Type text/plain;
  60. return 204;
  61. }
  62. }
  63. # OA H5(mobile-oa-h5,vite base=/oa-h5/)
  64. location = /oa-h5 {
  65. return 301 /oa-h5/;
  66. }
  67. location ^~ /oa-h5/ {
  68. root /usr/share/nginx/html;
  69. try_files $uri $uri/ /oa-h5/index.html;
  70. add_header Cache-Control "no-cache" always;
  71. }
  72. location / {
  73. try_files $uri $uri/ /index.html;
  74. }
  75. location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
  76. expires 30d;
  77. add_header Cache-Control "public, immutable" always;
  78. add_header X-Content-Type-Options nosniff always;
  79. access_log off;
  80. }
  81. location ~* \.html$ {
  82. add_header Cache-Control "no-cache, no-store, must-revalidate" always;
  83. add_header Pragma "no-cache" always;
  84. add_header Expires "0" always;
  85. }
  86. location ~ /\. {
  87. deny all;
  88. access_log off;
  89. log_not_found off;
  90. }
  91. }