zkxw-test-10001.conf 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. # ZKXW 测试环境(裸机)— 部署到 101.35.245.122
  2. # 支持:
  3. # - https://www.chengyantek.cn (443,SSL)
  4. # - http://www.chengyantek.cn / http://chengyantek.cn → 301 到 https://www
  5. # - http://IP:10001 (兼容旧入口,无强制跳转)
  6. #
  7. # 证书部署路径(服务器):
  8. # /root/zkxw/cert/www.chengyantek.cn.pem
  9. # /root/zkxw/cert/www.chengyantek.cn.key
  10. #
  11. # 用法(Ubuntu/Debian):
  12. # cp 到 /etc/nginx/sites-available/zkxw-test-10001.conf
  13. # ln -sfn ... /etc/nginx/sites-enabled/
  14. # nginx -t && systemctl reload nginx
  15. # ---------- HTTP → HTTPS(域名)----------
  16. server {
  17. listen 80;
  18. listen [::]:80;
  19. server_name www.chengyantek.cn chengyantek.cn;
  20. return 301 https://www.chengyantek.cn$request_uri;
  21. }
  22. # ---------- apex HTTPS → www ----------
  23. server {
  24. listen 443 ssl http2;
  25. listen [::]:443 ssl http2;
  26. server_name chengyantek.cn;
  27. ssl_certificate /root/zkxw/cert/www.chengyantek.cn.pem;
  28. ssl_certificate_key /root/zkxw/cert/www.chengyantek.cn.key;
  29. ssl_session_cache shared:SSL:10m;
  30. ssl_session_timeout 1h;
  31. ssl_protocols TLSv1.2 TLSv1.3;
  32. ssl_ciphers HIGH:!aNULL:!MD5;
  33. ssl_prefer_server_ciphers on;
  34. return 301 https://www.chengyantek.cn$request_uri;
  35. }
  36. # ---------- 主站 HTTPS ----------
  37. server {
  38. listen 443 ssl http2;
  39. listen [::]:443 ssl http2;
  40. server_name www.chengyantek.cn;
  41. ssl_certificate /root/zkxw/cert/www.chengyantek.cn.pem;
  42. ssl_certificate_key /root/zkxw/cert/www.chengyantek.cn.key;
  43. ssl_session_cache shared:SSL:10m;
  44. ssl_session_timeout 1h;
  45. ssl_protocols TLSv1.2 TLSv1.3;
  46. ssl_ciphers HIGH:!aNULL:!MD5;
  47. ssl_prefer_server_ciphers on;
  48. root /root/zkxw/web-admin/dist;
  49. index index.html;
  50. client_max_body_size 100M;
  51. access_log /var/log/nginx/zkxw_admin_https_access.log;
  52. error_log /var/log/nginx/zkxw_admin_https_error.log;
  53. location = /health {
  54. proxy_pass http://127.0.0.1:10002/health;
  55. proxy_http_version 1.1;
  56. proxy_set_header Host $host;
  57. proxy_connect_timeout 10s;
  58. proxy_read_timeout 30s;
  59. }
  60. location ^~ /docs {
  61. proxy_pass http://127.0.0.1:10002;
  62. proxy_http_version 1.1;
  63. proxy_set_header Host $host;
  64. proxy_set_header X-Real-IP $remote_addr;
  65. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  66. proxy_set_header X-Forwarded-Proto $scheme;
  67. }
  68. location = /openapi.json {
  69. proxy_pass http://127.0.0.1:10002/openapi.json;
  70. proxy_http_version 1.1;
  71. proxy_set_header Host $host;
  72. }
  73. location ^~ /api/ {
  74. proxy_pass http://127.0.0.1:10002;
  75. proxy_http_version 1.1;
  76. proxy_set_header Host $host;
  77. proxy_set_header X-Real-IP $remote_addr;
  78. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  79. proxy_set_header X-Forwarded-Proto $scheme;
  80. proxy_connect_timeout 10s;
  81. proxy_send_timeout 120s;
  82. proxy_read_timeout 120s;
  83. }
  84. # MinIO 同域反代(避免 HTTPS 页面对 http://47.99.164.66:20004 混合内容)
  85. location ^~ /minio/zkxw/ {
  86. proxy_pass http://47.99.164.66:20004/zkxw/;
  87. proxy_http_version 1.1;
  88. proxy_set_header Host $http_host;
  89. proxy_set_header X-Real-IP $remote_addr;
  90. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  91. proxy_set_header X-Forwarded-Proto $scheme;
  92. proxy_request_buffering off;
  93. proxy_buffering off;
  94. proxy_read_timeout 600s;
  95. proxy_send_timeout 600s;
  96. proxy_connect_timeout 10s;
  97. add_header Access-Control-Allow-Origin * always;
  98. add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
  99. }
  100. # mobile-oa-h5(Vite base=/oa-h5/;静态目录 /root/zkxw/static/oa-h5)
  101. # mobile-h5 配置 OA_H5_ORIGIN=https://www.chengyantek.cn/oa-h5
  102. location = /oa-h5 {
  103. return 301 /oa-h5/$is_args$args;
  104. }
  105. location ^~ /oa-h5/ {
  106. root /root/zkxw/static;
  107. try_files $uri $uri/ /oa-h5/index.html;
  108. }
  109. location / {
  110. try_files $uri $uri/ /index.html;
  111. }
  112. }
  113. # ---------- 兼容旧入口:IP:10001(HTTP)----------
  114. server {
  115. listen 10001;
  116. listen [::]:10001;
  117. server_name 101.35.245.122 localhost 127.0.0.1;
  118. root /root/zkxw/web-admin/dist;
  119. index index.html;
  120. client_max_body_size 100M;
  121. access_log /var/log/nginx/zkxw_admin_10001_access.log;
  122. error_log /var/log/nginx/zkxw_admin_10001_error.log;
  123. location = /health {
  124. proxy_pass http://127.0.0.1:10002/health;
  125. proxy_http_version 1.1;
  126. proxy_set_header Host $host;
  127. proxy_connect_timeout 10s;
  128. proxy_read_timeout 30s;
  129. }
  130. location ^~ /docs {
  131. proxy_pass http://127.0.0.1:10002;
  132. proxy_http_version 1.1;
  133. proxy_set_header Host $host;
  134. proxy_set_header X-Real-IP $remote_addr;
  135. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  136. proxy_set_header X-Forwarded-Proto $scheme;
  137. }
  138. location = /openapi.json {
  139. proxy_pass http://127.0.0.1:10002/openapi.json;
  140. proxy_http_version 1.1;
  141. proxy_set_header Host $host;
  142. }
  143. location ^~ /api/ {
  144. proxy_pass http://127.0.0.1:10002;
  145. proxy_http_version 1.1;
  146. proxy_set_header Host $host;
  147. proxy_set_header X-Real-IP $remote_addr;
  148. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  149. proxy_set_header X-Forwarded-Proto $scheme;
  150. proxy_connect_timeout 10s;
  151. proxy_send_timeout 120s;
  152. proxy_read_timeout 120s;
  153. }
  154. location ^~ /minio/zkxw/ {
  155. proxy_pass http://47.99.164.66:20004/zkxw/;
  156. proxy_http_version 1.1;
  157. proxy_set_header Host $http_host;
  158. proxy_set_header X-Real-IP $remote_addr;
  159. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  160. proxy_set_header X-Forwarded-Proto $scheme;
  161. proxy_request_buffering off;
  162. proxy_buffering off;
  163. proxy_read_timeout 600s;
  164. proxy_send_timeout 600s;
  165. proxy_connect_timeout 10s;
  166. add_header Access-Control-Allow-Origin * always;
  167. add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
  168. }
  169. location = /oa-h5 {
  170. return 301 /oa-h5/$is_args$args;
  171. }
  172. location ^~ /oa-h5/ {
  173. root /root/zkxw/static;
  174. try_files $uri $uri/ /oa-h5/index.html;
  175. }
  176. location / {
  177. try_files $uri $uri/ /index.html;
  178. }
  179. }