nginx 命令
2019-07-01 本文已影响0人
唐岭云
安装nginx
yum install nginx -y
禁止更新
我们在安装之后,为了能够正常运行,我们一般会禁止Nginx进行更新。因为在yum更新了Nginx之后,Nginx会自动重启。这对于我们来说是没有必要的,所以我们可以屏蔽更新。我们可以这样,将下列指定放到你的/etc/yum.conf文件中:
exclude=nginx
更新Nginx
一般在生产环境,我们都是禁用更新的。所以说,这里只是作为一个参考。
我们需要执行的命令就是:
yum update nginx
注意: 在使用 yum 更新之后,Nginx会自动重启。
命令管理:
启动
systemctl start nginx
重启
systemctl restart nginx
测试配置文件语法是否正确
nginx -t
重载配置文件
systemctl reload nginx
停止
systemctl stop nginx
启动开机启动
systemctl enable nginx
禁止开机启动
systemctl diasble nginx