安装nginx1.16.1版本
一、添加源
到 cd /etc/yum.repos.d/ 目录下
新建nginx.repo 文件
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 search nginx看看是否已经添加源成功。如果成功则执行下列命令安装nginx。
yum install -y nginx
三、启动nginx
service nginx start
service nginx stop
service nginx restart
五、查看版本,重启后OK
nginx -v
nginx version: nginx/1.16.1
service nginx start