fix(ci): nginx reload 改用 systemctl reload-or-restart,避免空 PID 文件报错
Deploy / build-linux-web (push) Successful in 1m1s
Deploy / build-windows (push) Successful in 1m42s
Deploy / build-macos (push) Successful in 1m2s
Deploy / release-deploy (push) Failing after 1m17s

nginx -s reload 依赖 /run/nginx.pid,该文件为空时报 invalid PID number。
改用 systemctl reload-or-restart(经 systemd MAINPID 发 HUP,运行中则 reload、
未运行则启动),并 enable nginx 保证重启后自启。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-03 09:33:24 +08:00
parent 6f0b273950
commit f4beb90769
2 changed files with 11 additions and 2 deletions
+6 -2
View File
@@ -126,9 +126,13 @@ mkdir -p /opt/jiu/marketing
rsync -a --delete /tmp/jiu-marketing-new/ /opt/jiu/marketing/
rm -rf /tmp/jiu-marketing-new
# Update nginx config and reload
# Update nginx config and reload.
# reload-or-restart: reload if nginx is running, start it if it's not — avoids
# `nginx -s reload` failing with "invalid PID number" when nginx isn't running
# (e.g. after an EC2 reboot where nginx didn't auto-start).
sudo cp /tmp/nginx-jiu.conf /etc/nginx/conf.d/jiu.conf
sudo nginx -t && sudo nginx -s reload
sudo systemctl enable nginx >/dev/null 2>&1 || true # auto-start on future reboots
sudo nginx -t && sudo systemctl reload-or-restart nginx
echo "Deploy complete!"
ENDSSH