feat(h5): unify WeChat OAuth under m.runxian.top path routing
Serve user/shop/partner H5 under /user/, /shop/, /partner/ on a single authorized domain; update nginx, SSL script, and router base paths. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
# 为杜康 runxian.top 五域名申请 Let's Encrypt 并切换 HTTPS 配置
|
||||
# 为杜康 runxian.top 申请 Let's Encrypt 并切换 HTTPS 配置
|
||||
# 三端 H5 统一入口 m.runxian.top(微信网页授权单域名)
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
DOMAINS=(
|
||||
m.runxian.top
|
||||
user.runxian.top
|
||||
shop.runxian.top
|
||||
partner.runxian.top
|
||||
@@ -25,7 +27,8 @@ mkdir -p /var/www/certbot /var/log/nginx/dukang
|
||||
|
||||
echo "==> 申请证书..."
|
||||
certbot certonly --webroot -w /var/www/certbot \
|
||||
--cert-name user.runxian.top \
|
||||
--cert-name m.runxian.top \
|
||||
-d m.runxian.top \
|
||||
-d user.runxian.top \
|
||||
-d shop.runxian.top \
|
||||
-d partner.runxian.top \
|
||||
@@ -43,13 +46,14 @@ systemctl reload nginx
|
||||
|
||||
echo "==> 验证..."
|
||||
for url in \
|
||||
https://m.runxian.top/user/ \
|
||||
https://m.runxian.top/shop/ \
|
||||
https://m.runxian.top/partner/ \
|
||||
https://user.runxian.top/ \
|
||||
https://shop.runxian.top/ \
|
||||
https://partner.runxian.top/ \
|
||||
https://webadmin.runxian.top/ \
|
||||
https://dkapi.runxian.top/api/v1/health; do
|
||||
code="$(curl -sf -o /dev/null -w '%{http_code}' "$url" || echo fail)"
|
||||
echo " $url -> $code"
|
||||
done
|
||||
|
||||
echo "==> runxian.top 杜康域名 HTTPS 已启用"
|
||||
echo "==> runxian.top 杜康域名 HTTPS 已启用(H5 统一入口 m.runxian.top)"
|
||||
|
||||
@@ -1,28 +1,16 @@
|
||||
# 杜康好客 — runxian.top HTTPS(证书申请后启用)
|
||||
# 杜康好客 — runxian.top HTTPS
|
||||
# 执行: deploy/enable-runxian-dukang-ssl.sh
|
||||
|
||||
map $host $dukang_runxian_port {
|
||||
user.runxian.top 8091;
|
||||
shop.runxian.top 8092;
|
||||
partner.runxian.top 8093;
|
||||
webadmin.runxian.top 8094;
|
||||
}
|
||||
# 三端 H5 统一入口 m.runxian.top/{user,shop,partner}/
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name user.runxian.top shop.runxian.top partner.runxian.top;
|
||||
server_name m.runxian.top user.runxian.top shop.runxian.top partner.runxian.top;
|
||||
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
default_type "text/plain";
|
||||
}
|
||||
|
||||
location ~ ^/MP_verify_.*\.txt$ {
|
||||
root /opt/dukang-haoke/apps/h5-user/dist;
|
||||
default_type text/plain;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
@@ -30,18 +18,24 @@ server {
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name user.runxian.top shop.runxian.top partner.runxian.top;
|
||||
server_name m.runxian.top;
|
||||
|
||||
access_log /var/log/nginx/dukang/runxian-h5.access.log main;
|
||||
error_log /var/log/nginx/dukang/runxian-h5.error.log warn;
|
||||
access_log /var/log/nginx/dukang/runxian-m.access.log main;
|
||||
error_log /var/log/nginx/dukang/runxian-m.error.log warn;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/user.runxian.top/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/user.runxian.top/privkey.pem;
|
||||
ssl_certificate /etc/letsencrypt/live/m.runxian.top/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/m.runxian.top/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
client_max_body_size 20m;
|
||||
|
||||
location ~ ^/MP_verify_.*\.txt$ {
|
||||
root /opt/dukang-haoke/apps/h5-user/dist;
|
||||
default_type text/plain;
|
||||
access_log off;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:8090;
|
||||
proxy_http_version 1.1;
|
||||
@@ -52,14 +46,57 @@ server {
|
||||
proxy_set_header Connection "";
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:$dukang_runxian_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;
|
||||
location = / {
|
||||
return 302 /user/;
|
||||
}
|
||||
|
||||
location /user/ {
|
||||
alias /opt/dukang-haoke/apps/h5-user/dist/;
|
||||
try_files $uri $uri/ index.html;
|
||||
}
|
||||
|
||||
location /shop/ {
|
||||
alias /opt/dukang-haoke/apps/h5-shop/dist/;
|
||||
try_files $uri $uri/ index.html;
|
||||
}
|
||||
|
||||
location /partner/ {
|
||||
alias /opt/dukang-haoke/apps/h5-partner/dist/;
|
||||
try_files $uri $uri/ index.html;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name user.runxian.top;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/m.runxian.top/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/m.runxian.top/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
|
||||
return 301 https://m.runxian.top/user$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name shop.runxian.top;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/m.runxian.top/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/m.runxian.top/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
|
||||
return 301 https://m.runxian.top/shop$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name partner.runxian.top;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/m.runxian.top/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/m.runxian.top/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
|
||||
return 301 https://m.runxian.top/partner$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
@@ -83,8 +120,8 @@ server {
|
||||
access_log /var/log/nginx/dukang/runxian-api.access.log main;
|
||||
error_log /var/log/nginx/dukang/runxian-api.error.log warn;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/user.runxian.top/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/user.runxian.top/privkey.pem;
|
||||
ssl_certificate /etc/letsencrypt/live/m.runxian.top/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/m.runxian.top/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
@@ -122,8 +159,8 @@ server {
|
||||
access_log /var/log/nginx/dukang/runxian-admin.access.log main;
|
||||
error_log /var/log/nginx/dukang/runxian-admin.error.log warn;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/user.runxian.top/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/user.runxian.top/privkey.pem;
|
||||
ssl_certificate /etc/letsencrypt/live/m.runxian.top/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/m.runxian.top/privkey.pem;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
# 杜康好客 — runxian.top 别名域名(与 lingshivip.cn 同后端)
|
||||
# user/shop/partner → 8091/8092/8093;webadmin → 8094;dkapi → 8090
|
||||
# 证书:certbot --cert-name user.runxian.top -d user.runxian.top -d shop.runxian.top ...
|
||||
# 杜康好客 — runxian.top(HTTP)
|
||||
# 三端 H5 统一入口 m.runxian.top/{user,shop,partner}/(微信网页授权单域名)
|
||||
# 旧子域名 user/shop/partner 301 到统一入口;webadmin → 8094;dkapi → 8090
|
||||
|
||||
map $host $dukang_runxian_port {
|
||||
user.runxian.top 8091;
|
||||
shop.runxian.top 8092;
|
||||
partner.runxian.top 8093;
|
||||
webadmin.runxian.top 8094;
|
||||
}
|
||||
|
||||
# --- HTTP: H5 三端(校验文件 + API;证书就绪后见 dukang-runxian-ssl.conf)---
|
||||
# --- 统一 H5 入口(证书就绪前 HTTP;HTTPS 见 dukang-runxian-ssl.conf)---
|
||||
server {
|
||||
listen 80;
|
||||
server_name user.runxian.top shop.runxian.top partner.runxian.top;
|
||||
server_name m.runxian.top;
|
||||
|
||||
access_log /var/log/nginx/dukang/runxian-h5.access.log main;
|
||||
error_log /var/log/nginx/dukang/runxian-h5.error.log warn;
|
||||
access_log /var/log/nginx/dukang/runxian-m.access.log main;
|
||||
error_log /var/log/nginx/dukang/runxian-m.error.log warn;
|
||||
|
||||
client_max_body_size 20m;
|
||||
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
@@ -38,14 +33,43 @@ server {
|
||||
proxy_set_header Connection "";
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:$dukang_runxian_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;
|
||||
location = / {
|
||||
return 302 /user/;
|
||||
}
|
||||
|
||||
location /user/ {
|
||||
alias /opt/dukang-haoke/apps/h5-user/dist/;
|
||||
try_files $uri $uri/ index.html;
|
||||
}
|
||||
|
||||
location /shop/ {
|
||||
alias /opt/dukang-haoke/apps/h5-shop/dist/;
|
||||
try_files $uri $uri/ index.html;
|
||||
}
|
||||
|
||||
location /partner/ {
|
||||
alias /opt/dukang-haoke/apps/h5-partner/dist/;
|
||||
try_files $uri $uri/ index.html;
|
||||
}
|
||||
}
|
||||
|
||||
# --- 旧 H5 子域名 → 统一入口(保留书签/推广链接)---
|
||||
server {
|
||||
listen 80;
|
||||
server_name user.runxian.top;
|
||||
return 301 http://m.runxian.top/user$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name shop.runxian.top;
|
||||
return 301 http://m.runxian.top/shop$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name partner.runxian.top;
|
||||
return 301 http://m.runxian.top/partner$request_uri;
|
||||
}
|
||||
|
||||
# --- HTTP: API ---
|
||||
|
||||
Reference in New Issue
Block a user