zkxw-test-10001.conf 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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. # 附件上传:大文件要等正文传完再落存储,不能跟普通接口共用 120s
  74. location ^~ /api/web/admin/attachment/upload {
  75. proxy_pass http://127.0.0.1:10002;
  76. proxy_http_version 1.1;
  77. proxy_set_header Host $host;
  78. proxy_set_header X-Real-IP $remote_addr;
  79. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  80. proxy_set_header X-Forwarded-Proto $scheme;
  81. proxy_request_buffering off;
  82. proxy_connect_timeout 30s;
  83. proxy_send_timeout 300s;
  84. proxy_read_timeout 300s;
  85. }
  86. location ^~ /api/ {
  87. proxy_pass http://127.0.0.1:10002;
  88. proxy_http_version 1.1;
  89. proxy_set_header Host $host;
  90. proxy_set_header X-Real-IP $remote_addr;
  91. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  92. proxy_set_header X-Forwarded-Proto $scheme;
  93. proxy_connect_timeout 10s;
  94. proxy_send_timeout 120s;
  95. proxy_read_timeout 120s;
  96. }
  97. # MinIO 同域反代(避免 HTTPS 页面对 http://47.99.164.66:20004 混合内容)
  98. location ^~ /minio/zkxw/ {
  99. proxy_pass http://47.99.164.66:20004/zkxw/;
  100. proxy_http_version 1.1;
  101. proxy_set_header Host $http_host;
  102. proxy_set_header X-Real-IP $remote_addr;
  103. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  104. proxy_set_header X-Forwarded-Proto $scheme;
  105. proxy_request_buffering off;
  106. proxy_buffering off;
  107. proxy_read_timeout 600s;
  108. proxy_send_timeout 600s;
  109. proxy_connect_timeout 10s;
  110. add_header Access-Control-Allow-Origin * always;
  111. add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
  112. }
  113. # mobile-oa-h5(Vite base=/oa-h5/;静态目录 /root/zkxw/static/oa-h5)
  114. # mobile-h5 配置 OA_H5_ORIGIN=https://www.chengyantek.cn/oa-h5
  115. location = /oa-h5 {
  116. return 301 /oa-h5/$is_args$args;
  117. }
  118. location ^~ /oa-h5/ {
  119. root /root/zkxw/static;
  120. try_files $uri $uri/ /oa-h5/index.html;
  121. }
  122. location / {
  123. try_files $uri $uri/ /index.html;
  124. }
  125. }
  126. # ---------- 兼容旧入口:IP:10001(HTTP)----------
  127. server {
  128. listen 10001;
  129. listen [::]:10001;
  130. server_name 101.35.245.122 localhost 127.0.0.1;
  131. root /root/zkxw/web-admin/dist;
  132. index index.html;
  133. client_max_body_size 100M;
  134. access_log /var/log/nginx/zkxw_admin_10001_access.log;
  135. error_log /var/log/nginx/zkxw_admin_10001_error.log;
  136. location = /health {
  137. proxy_pass http://127.0.0.1:10002/health;
  138. proxy_http_version 1.1;
  139. proxy_set_header Host $host;
  140. proxy_connect_timeout 10s;
  141. proxy_read_timeout 30s;
  142. }
  143. location ^~ /docs {
  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. }
  151. location = /openapi.json {
  152. proxy_pass http://127.0.0.1:10002/openapi.json;
  153. proxy_http_version 1.1;
  154. proxy_set_header Host $host;
  155. }
  156. # 附件上传:大文件要等正文传完再落存储,不能跟普通接口共用 120s
  157. location ^~ /api/web/admin/attachment/upload {
  158. proxy_pass http://127.0.0.1:10002;
  159. proxy_http_version 1.1;
  160. proxy_set_header Host $host;
  161. proxy_set_header X-Real-IP $remote_addr;
  162. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  163. proxy_set_header X-Forwarded-Proto $scheme;
  164. proxy_request_buffering off;
  165. proxy_connect_timeout 30s;
  166. proxy_send_timeout 300s;
  167. proxy_read_timeout 300s;
  168. }
  169. location ^~ /api/ {
  170. proxy_pass http://127.0.0.1:10002;
  171. proxy_http_version 1.1;
  172. proxy_set_header Host $host;
  173. proxy_set_header X-Real-IP $remote_addr;
  174. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  175. proxy_set_header X-Forwarded-Proto $scheme;
  176. proxy_connect_timeout 10s;
  177. proxy_send_timeout 120s;
  178. proxy_read_timeout 120s;
  179. }
  180. location ^~ /minio/zkxw/ {
  181. proxy_pass http://47.99.164.66:20004/zkxw/;
  182. proxy_http_version 1.1;
  183. proxy_set_header Host $http_host;
  184. proxy_set_header X-Real-IP $remote_addr;
  185. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  186. proxy_set_header X-Forwarded-Proto $scheme;
  187. proxy_request_buffering off;
  188. proxy_buffering off;
  189. proxy_read_timeout 600s;
  190. proxy_send_timeout 600s;
  191. proxy_connect_timeout 10s;
  192. add_header Access-Control-Allow-Origin * always;
  193. add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
  194. }
  195. location = /oa-h5 {
  196. return 301 /oa-h5/$is_args$args;
  197. }
  198. location ^~ /oa-h5/ {
  199. root /root/zkxw/static;
  200. try_files $uri $uri/ /oa-h5/index.html;
  201. }
  202. location / {
  203. try_files $uri $uri/ /index.html;
  204. }
  205. }