Web 服务快速启动手册
Web 服务快速启动手册(行内速查)
适用场景:日常运维、故障恢复、服务器重启后快速拉起服务
统一原则:root 管理,业务进程使用 mng 用户
一、快速启动顺序(推荐)
# 1. 启动 php-fpm
systemctl start php-fpm
# 或
service php-fpm start
# 2. 启动 nginx
systemctl start nginx
# 或
service nginx start
# 3. 启动 supervisor
systemctl start supervisord
# 或
service supervisord start
二、快速停止顺序
service nginx stop
service php-fpm stop
service supervisord stop
如 php-fpm 停止失败,可使用:
service php-fpm stop -quit
三、状态检查(最常用)
service php-fpm status
service nginx status
service supervisord status
或
systemctl status php-fpm
systemctl status nginx
systemctl status supervisord
四、进程 & 用户确认(排障必查)
ps -ef | grep php-fpm
ps -ef | grep nginx
ps -ef | grep supervisord
确认要点:
php-fpm worker 是否为 mng
nginx worker 是否为 mng
supervisor program 是否以 mng 运行
五、常见问题速查
1️⃣ php-fpm 一直启动卡住
检查 pid 文件路径是否写错
正确示例:
pid = /run/php-fpm.pid
2️⃣ 提示 user directive is ignored
Notice: pool www user directive is ignored when fpm is not running as root
处理方式(二选一):
推荐:删除 pool 中的 user / group
或:让 php-fpm master 以 root 启动
3️⃣ Redis 类不存在 / 扩展未加载
快速验证:
php -m | grep redis
php -i | grep redis
注意:
CLI 和 php-fpm 使用的 php.ini 可能不同
php-fpm 启动时务必指定正确路径
六、紧急恢复(一条命令)
systemctl daemon-reload
service php-fpm restart
service nginx restart
service supervisord restart
七、统一规范速记
❌ 不用二进制直启(./nginx、php-fpm)
✅ 统一使用 service / systemctl
✅ root 管理,mng 跑业务
✅ PID、日志路径必须真实存在
📌 建议:将本手册放在
/opt/docs/runbook.md或运维 Wiki 中
本作品采用《CC 协议》,转载必须注明作者和本文链接
关于 LearnKu