CentOS7.X中使用yum安装nginx

nginx官方文档说明:http://nginx.org/en/linux_packages.html#RHEL-CentOS

添加源

cd /etc/yum.repos.d/
vim nginx.repo

插入下面的内容

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key

安装nginx

yum install -y nginx

启动nginx

#启动nginx
systemctl start nginx
#设置开机自启
systemctl enable nginx
#查看服务状态
systemctl status nginx
posted @ 2020-12-07 21:19  唐磊(Jason)  阅读(438)  评论(0编辑  收藏  举报