掌握Docker多阶段构建镜像优化技巧
2026/7/8 23:59:59
在一些比较好的环境下,我们会把nginx做成Linux的服务
systemctl start nginx# 优雅停止(等待请求结束,推荐) systemctl stop nginx # 强制立即停止 nginx -s stop# 完整重启(会断开连接) systemctl restart nginx修改配置后必用,不重启进程
systemctl reload nginx # 等价命令 nginx -s reloadsystemctl status nginx# 开启开机启动 systemctl enable nginx # 关闭开机启动 systemctl disable nginx# 优雅退出(等待请求处理完再关闭) nginx -s quit # 强制停止 nginx -s stop # 重载配置 nginx -s reload # 重新打开日志(切割日志用) nginx -s reopen # 检查配置语法是否正确 nginx -t # 检查并打印详细配置路径 nginx -T # 查看版本 nginx -v # 查看版本 + 编译模块/参数 nginx -V# 查看 Nginx 进程 ps aux | grep nginx # 查看监听端口(默认80/443) ss -tulpn | grep nginx netstat -tulpn | grep nginx # 杀进程(卡死时应急) pkill -9 nginx# 一般路径 /var/log/nginx/access.log tail -f /var/log/nginx/access.log tail -f /var/log/nginx/error.log# 用自定义配置文件启动 Nginx nginx -c /etc/nginx/nginx-new.conf