# 杜康好客 — lingshivip.cn 五端 + API # API 8090;H5 8091/8092/8093;admin-web 8094 map $host $dukang_lingshi_port { user.lingshivip.cn 8091; shop.lingshivip.cn 8092; partner.lingshivip.cn 8093; admin.lingshivip.cn 8094; } # HTTP → HTTPS(H5 三端) server { listen 80; server_name user.lingshivip.cn shop.lingshivip.cn partner.lingshivip.cn; location ^~ /.well-known/acme-challenge/ { root /var/www/certbot; default_type "text/plain"; } location / { return 301 https://$host$request_uri; } } # API:证书就绪前 HTTP 直连;就绪后改走 HTTPS server server { listen 80; server_name api.lingshivip.cn; location ^~ /.well-known/acme-challenge/ { root /var/www/certbot; default_type "text/plain"; } location / { proxy_pass http://127.0.0.1:8090; 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_set_header Connection ""; } } # admin 待 DNS + 证书就绪前先走 HTTP server { listen 80; server_name admin.lingshivip.cn; location ^~ /.well-known/acme-challenge/ { root /var/www/certbot; default_type "text/plain"; } location /api/ { proxy_pass http://127.0.0.1:8090; 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_set_header Connection ""; } location / { proxy_pass http://127.0.0.1:8094; 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; } } # API 独立域名 HTTPS(证书:/etc/nginx/ssl/api.lingshivip.cn/) server { listen 443 ssl; server_name api.lingshivip.cn; access_log /var/log/nginx/dukang/lingshi-api.access.log main; error_log /var/log/nginx/dukang/lingshi-api.error.log warn; ssl_certificate /etc/nginx/ssl/api.lingshivip.cn/fullchain.cer; ssl_certificate_key /etc/nginx/ssl/api.lingshivip.cn/api.lingshivip.cn.key; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; client_max_body_size 20m; location / { proxy_pass http://127.0.0.1:8090; 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_set_header Connection ""; } } server { listen 443 ssl; server_name user.lingshivip.cn shop.lingshivip.cn partner.lingshivip.cn; access_log /var/log/nginx/dukang/lingshi.access.log main; error_log /var/log/nginx/dukang/lingshi.error.log warn; ssl_certificate /etc/letsencrypt/live/user.lingshivip.cn/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/user.lingshivip.cn/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; client_max_body_size 20m; location /api/ { proxy_pass http://127.0.0.1:8090; 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_set_header Connection ""; } location / { proxy_pass http://127.0.0.1:$dukang_lingshi_port; 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; } }