按照道理將應該不會有什麼問題,可是在阿里雲的 CentOS 系統裏找不到這個包。nginx
能夠直接從官方的源中安裝: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