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

安装依赖

sudo yum install yum-utils

设置yum库

创建文件 /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

[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

mainline版本

如果要安装mainline版本,运行需要运行下面的命令:

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

安装

sudo yum install nginx

文章来源于互联网,如有雷同请联系站长删除:centos 7 安装nginx

发表评论