diff --git a/infra/deploy/launch.sh b/infra/deploy/launch.sh index f4d021d..3014030 100755 --- a/infra/deploy/launch.sh +++ b/infra/deploy/launch.sh @@ -6,7 +6,8 @@ set -eu DRY=1 [ "${1:-}" = "--exec" ] && DRY=0 NGINX_DEFAULT=/etc/nginx/sites-available/default -STAGING="$HOME/docker_apps/blog/www-staging" +# sudo 下 $HOME=/root:路径必须写死用户绝对路径,不能用 $HOME +STAGING="/home/wait4x/docker_apps/blog/www-staging" TS=$(date +%Y%m%d-%H%M%S) # 目标:wait4x.online server 块内 location / 的 proxy_pass 换为静态 root。 @@ -35,7 +36,9 @@ path = sys.argv[1] s = open(path, encoding="utf-8").read() lines = s.splitlines(keepends=True) start = next(i for i, l in enumerate(lines) if "server_name wait4x.online;" in l) -depth = 0 +# server{ 开栏在 server_name 之前——从这行起算时已身处一层花括号内, +# 深度须从 1 起算(0 起算会在下一行误判块闭合,切片只剩一行) +depth = 1 for i in range(start, len(lines)): depth += lines[i].count("{") - lines[i].count("}") if i > start and depth == 0: