fix(ci): nginx reload 改用 systemctl reload-or-restart,避免空 PID 文件报错
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:
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [1.0.8] - 2026-06-03
|
||||
|
||||
### 修复
|
||||
- 修复 EC2 部署最后一步 nginx reload 失败(`invalid PID number`):改用 `systemctl reload-or-restart nginx`(经 systemd MAINPID 发 HUP,不依赖空的 /run/nginx.pid),并 `enable nginx` 确保重启后自启
|
||||
|
||||
## [1.0.7] - 2026-06-03
|
||||
|
||||
### 修复
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user