CentOS 7 快速安装 nginx

阅读 67

2022-03-22

安装需求

sudo yum install yum-utils

To set up the yum repository, create the file named /etc/yum.repos.d/nginx.repo with the following contents:
创建一个文件

vi /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

默认会安装nginx 的稳定版本,如果想用mainline nginx 包,运行下面命令

sudo yum-config-manager --enable nginx-mainline

运行下面命令来安装 nginx

sudo yum install nginx

精彩评论(0)

0 0 举报