centos7安装nginx
添加nginx的yum仓库
sudo vim /etc/yum.repos.d/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
module_hotfixes=true
[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
module_hotfixes=true
安装步骤
# 查看可用版本(enable)
yum repolist all| grep nginx
# 默认时最新稳定版,要安装开发版的话,需要执行此行
#sudo yum-config-manager --enable nginx-mainline
# 安装
sudo yum install nginx
# 启动nginx并设置开机自启
systemctl start nginx
systemctl enable nginx
# 确认安装成功
curl http://127.0.01