按照道理将应该不会有什么问题,但是在阿里云的 CentOS 系统里找不到这个包。
可以直接从官方的源中安装:
# http://nginx.org/packages/centos/7/x86_64/RPMS/ rpm -ivh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.8.1-1.el7.ngx.x86_64.rpm
#!/bin/sh # 配置源 cat << ‘EOF‘ > /etc/yum.repos.d/cstm-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 EOF # 启用mainline版本(此时需要安装yum-utils包) # yum install -y yum-utils # yum-config-manager --enable nginx-mainline # 更新缓存 yum makecache # 安装 yum install -y nginx.x86_64
原文:https://www.cnblogs.com/k4nz/p/14483001.html