| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- # ZKXW 测试环境(裸机)— 部署到 101.35.245.122
- # 支持:
- # - https://www.chengyantek.cn (443,SSL)
- # - http://www.chengyantek.cn / http://chengyantek.cn → 301 到 https://www
- # - http://IP:10001 (兼容旧入口,无强制跳转)
- #
- # 证书部署路径(服务器):
- # /root/zkxw/cert/www.chengyantek.cn.pem
- # /root/zkxw/cert/www.chengyantek.cn.key
- #
- # 用法(Ubuntu/Debian):
- # cp 到 /etc/nginx/sites-available/zkxw-test-10001.conf
- # ln -sfn ... /etc/nginx/sites-enabled/
- # nginx -t && systemctl reload nginx
- # ---------- HTTP → HTTPS(域名)----------
- server {
- listen 80;
- listen [::]:80;
- server_name www.chengyantek.cn chengyantek.cn;
- return 301 https://www.chengyantek.cn$request_uri;
- }
- # ---------- apex HTTPS → www ----------
- server {
- listen 443 ssl http2;
- listen [::]:443 ssl http2;
- server_name chengyantek.cn;
- ssl_certificate /root/zkxw/cert/www.chengyantek.cn.pem;
- ssl_certificate_key /root/zkxw/cert/www.chengyantek.cn.key;
- ssl_session_cache shared:SSL:10m;
- ssl_session_timeout 1h;
- ssl_protocols TLSv1.2 TLSv1.3;
- ssl_ciphers HIGH:!aNULL:!MD5;
- ssl_prefer_server_ciphers on;
- return 301 https://www.chengyantek.cn$request_uri;
- }
- # ---------- 主站 HTTPS ----------
- server {
- listen 443 ssl http2;
- listen [::]:443 ssl http2;
- server_name www.chengyantek.cn;
- ssl_certificate /root/zkxw/cert/www.chengyantek.cn.pem;
- ssl_certificate_key /root/zkxw/cert/www.chengyantek.cn.key;
- ssl_session_cache shared:SSL:10m;
- ssl_session_timeout 1h;
- ssl_protocols TLSv1.2 TLSv1.3;
- ssl_ciphers HIGH:!aNULL:!MD5;
- ssl_prefer_server_ciphers on;
- root /root/zkxw/web-admin/dist;
- index index.html;
- client_max_body_size 100M;
- access_log /var/log/nginx/zkxw_admin_https_access.log;
- error_log /var/log/nginx/zkxw_admin_https_error.log;
- location = /health {
- proxy_pass http://127.0.0.1:10002/health;
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- proxy_connect_timeout 10s;
- proxy_read_timeout 30s;
- }
- location ^~ /docs {
- proxy_pass http://127.0.0.1:10002;
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- }
- location = /openapi.json {
- proxy_pass http://127.0.0.1:10002/openapi.json;
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- }
- location ^~ /api/ {
- proxy_pass http://127.0.0.1:10002;
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_connect_timeout 10s;
- proxy_send_timeout 120s;
- proxy_read_timeout 120s;
- }
- # MinIO 同域反代(避免 HTTPS 页面对 http://47.99.164.66:20004 混合内容)
- location ^~ /minio/zkxw/ {
- proxy_pass http://47.99.164.66:20004/zkxw/;
- proxy_http_version 1.1;
- proxy_set_header Host $http_host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_request_buffering off;
- proxy_buffering off;
- proxy_read_timeout 600s;
- proxy_send_timeout 600s;
- proxy_connect_timeout 10s;
- add_header Access-Control-Allow-Origin * always;
- add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
- }
- # mobile-oa-h5(Vite base=/oa-h5/;静态目录 /root/zkxw/static/oa-h5)
- # mobile-h5 配置 OA_H5_ORIGIN=https://www.chengyantek.cn/oa-h5
- location = /oa-h5 {
- return 301 /oa-h5/$is_args$args;
- }
- location ^~ /oa-h5/ {
- root /root/zkxw/static;
- try_files $uri $uri/ /oa-h5/index.html;
- }
- location / {
- try_files $uri $uri/ /index.html;
- }
- }
- # ---------- 兼容旧入口:IP:10001(HTTP)----------
- server {
- listen 10001;
- listen [::]:10001;
- server_name 101.35.245.122 localhost 127.0.0.1;
- root /root/zkxw/web-admin/dist;
- index index.html;
- client_max_body_size 100M;
- access_log /var/log/nginx/zkxw_admin_10001_access.log;
- error_log /var/log/nginx/zkxw_admin_10001_error.log;
- location = /health {
- proxy_pass http://127.0.0.1:10002/health;
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- proxy_connect_timeout 10s;
- proxy_read_timeout 30s;
- }
- location ^~ /docs {
- proxy_pass http://127.0.0.1:10002;
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- }
- location = /openapi.json {
- proxy_pass http://127.0.0.1:10002/openapi.json;
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- }
- location ^~ /api/ {
- proxy_pass http://127.0.0.1:10002;
- proxy_http_version 1.1;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_connect_timeout 10s;
- proxy_send_timeout 120s;
- proxy_read_timeout 120s;
- }
- location ^~ /minio/zkxw/ {
- proxy_pass http://47.99.164.66:20004/zkxw/;
- proxy_http_version 1.1;
- proxy_set_header Host $http_host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_request_buffering off;
- proxy_buffering off;
- proxy_read_timeout 600s;
- proxy_send_timeout 600s;
- proxy_connect_timeout 10s;
- add_header Access-Control-Allow-Origin * always;
- add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
- }
- location = /oa-h5 {
- return 301 /oa-h5/$is_args$args;
- }
- location ^~ /oa-h5/ {
- root /root/zkxw/static;
- try_files $uri $uri/ /oa-h5/index.html;
- }
- location / {
- try_files $uri $uri/ /index.html;
- }
- }
|