美文网首页
Linux CentOS 7 yum安装nginx

Linux CentOS 7 yum安装nginx

作者: 秋燕归 | 来源:发表于2021-12-17 16:14 被阅读0次

1.添加源

sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

2.安装nginx

sudo yum install -y nginx

3.nginx常用命令

#查看版本:
nginx -v
#查看nginx安装目录:
ps  -ef | grep nginx
#检查配置文件:
nginx -t
#启动:
systemctl start nginx.service
#停止:
systemctl stop nginx.service
#重启:
systemctl restart nginx.service
#设置开机自启动:
systemctl enable nginx.service
#停止开机自启动:
systemctl disable nginx.service
#查看当前状态:
systemctl status nginx.service
#查看所有已启动的服务:
systemctl list-units --type=service

相关文章

网友评论

      本文标题:Linux CentOS 7 yum安装nginx

      本文链接:https://www.haomeiwen.com/subject/vtmifrtx.html