41 lines
1.4 KiB
Bash
41 lines
1.4 KiB
Bash
|
|
#!/bin/bash
|
|||
|
|
# 修复 souladmin.quwanzhi.com 登录 "Failed to fetch" 错误
|
|||
|
|
# 1. Vue 管理后台 API 改为同源(O1=""),请求 /api
|
|||
|
|
# 2. souladmin Nginx 代理 /api 到 souldev.quwanzhi.com
|
|||
|
|
|
|||
|
|
set -e
|
|||
|
|
cd "$(dirname "$0")/.."
|
|||
|
|
SSH_PORT="22022"
|
|||
|
|
BT_HOST="43.139.27.93"
|
|||
|
|
ADMIN_DIST="/www/wwwroot/自营/soul-admin/dist"
|
|||
|
|
|
|||
|
|
echo "===== 1. 上传 patched index-CbOmKBRd.js ====="
|
|||
|
|
sshpass -p 'Zhiqun1984' scp -P "$SSH_PORT" -o ConnectTimeout=15 \
|
|||
|
|
"soul-admin/dist/assets/index-CbOmKBRd.js" \
|
|||
|
|
root@${BT_HOST}:${ADMIN_DIST}/assets/
|
|||
|
|
|
|||
|
|
echo "===== 2. 配置 souladmin Nginx /api 代理 ====="
|
|||
|
|
sshpass -p 'Zhiqun1984' ssh -p "$SSH_PORT" -o ConnectTimeout=20 root@${BT_HOST} 'bash -s' << 'REMOTE'
|
|||
|
|
EXT_DIR="/www/server/panel/vhost/nginx/extension/souladmin.quwanzhi.com"
|
|||
|
|
mkdir -p "$EXT_DIR"
|
|||
|
|
API_CONF="$EXT_DIR/api-proxy.conf"
|
|||
|
|
cat > "$API_CONF" << 'NGX'
|
|||
|
|
location /api/ {
|
|||
|
|
proxy_pass https://souldev.quwanzhi.com/api/;
|
|||
|
|
proxy_ssl_server_name on;
|
|||
|
|
proxy_http_version 1.1;
|
|||
|
|
proxy_set_header Host souldev.quwanzhi.com;
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
NGX
|
|||
|
|
echo "api-proxy.conf 已写入"
|
|||
|
|
nginx -t 2>&1 && nginx -s reload 2>&1
|
|||
|
|
echo "Nginx 重载完成"
|
|||
|
|
REMOTE
|
|||
|
|
|
|||
|
|
echo ""
|
|||
|
|
echo "===== souladmin 登录修复完成 ====="
|
|||
|
|
echo "请访问 https://souladmin.quwanzhi.com 尝试登录"
|