这篇笔记我们记录一些Nginx中常见的管理命令。
假设Nginx已经正确的注册为了服务,我们直接用systemd
的管理命令即可管理Nginx。
# 启动服务
systemctl start nginx
# 停止服务
systemctl stop nginx
# 重启服务
systemctl restart nginx
# 查看服务状态
systemctl status nginx
# 开机启动服务
systemctl enable nginx
# 禁用开机启动服务
systemctl disable nginx
我们编写了配置文件后,不知道写的配置是否符合语法规范,所以需要Nginx为我们检查一下。
nginx -t
配置文件检查无误后,我们不用重启Nginx,直接重载配置文件即可。
nginx -s reload