Files
dukang/deploy/nginx-dukang-staging.conf

204 lines
6.5 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 杜康好客 — Staging(测试)*-test.dukanghaoke.com → 81908194
# 证书:可与生产共用 user.dukanghaoke.com 证书(SAN 含 *-test),或单独申请
# 启用:ln -sf /opt/dukang-staging/deploy/nginx-dukang-staging.conf /etc/nginx/sites-enabled/
# nginx -t && systemctl reload nginx
# HTTP → HTTPS
server {
listen 80;
server_name user-test.dukanghaoke.com shop-test.dukanghaoke.com partner-test.dukanghaoke.com admin-test.dukanghaoke.com api-test.dukanghaoke.com;
location ^~ /.well-known/acme-challenge/ {
root /var/www/certbot;
default_type "text/plain";
}
include /opt/dukang-staging/deploy/nginx-mp-verify-staging.conf;
location / {
return 301 https://$host$request_uri;
}
}
# api-test.dukanghaoke.com → 8190
server {
listen 443 ssl;
http2 on;
server_name api-test.dukanghaoke.com;
ssl_certificate /etc/letsencrypt/live/user.dukanghaoke.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/user.dukanghaoke.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 50m;
location / {
proxy_pass http://127.0.0.1:8190;
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 "";
}
}
# user-test.dukanghaoke.com → 8191
server {
listen 443 ssl;
http2 on;
server_name user-test.dukanghaoke.com;
ssl_certificate /etc/letsencrypt/live/user.dukanghaoke.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/user.dukanghaoke.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 50m;
include /opt/dukang-staging/deploy/nginx-mp-verify-staging.conf;
location /api/ {
proxy_pass http://127.0.0.1:8190;
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 "";
}
# 旧 /user 前缀书签 → 根路径(staging 独立域名,无 /user 子路径)
location = /user {
return 301 /;
}
location ^~ /user/ {
rewrite ^/user/(.*)$ /$1 permanent;
}
location / {
proxy_pass http://127.0.0.1:8191;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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_cache_bypass $http_upgrade;
}
}
# shop-test.dukanghaoke.com → 8192
server {
listen 443 ssl;
http2 on;
server_name shop-test.dukanghaoke.com;
ssl_certificate /etc/letsencrypt/live/user.dukanghaoke.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/user.dukanghaoke.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 50m;
include /opt/dukang-staging/deploy/nginx-mp-verify-staging.conf;
location /api/ {
proxy_pass http://127.0.0.1:8190;
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:8192;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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_cache_bypass $http_upgrade;
}
}
# partner-test.dukanghaoke.com → 8193
server {
listen 443 ssl;
http2 on;
server_name partner-test.dukanghaoke.com;
ssl_certificate /etc/letsencrypt/live/user.dukanghaoke.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/user.dukanghaoke.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 50m;
include /opt/dukang-staging/deploy/nginx-mp-verify-staging.conf;
location /api/ {
proxy_pass http://127.0.0.1:8190;
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:8193;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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_cache_bypass $http_upgrade;
}
}
# admin-test.dukanghaoke.com → 8194
server {
listen 443 ssl;
http2 on;
server_name admin-test.dukanghaoke.com;
ssl_certificate /etc/letsencrypt/live/user.dukanghaoke.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/user.dukanghaoke.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
client_max_body_size 50m;
location /api/ {
proxy_pass http://127.0.0.1:8190;
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:8194;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
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_cache_bypass $http_upgrade;
}
}