centos yum源不包含nginx, 需要使用rpm包安装:
rpm -ivh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.10.0-1.el7.ngx.x86_64.rpm
成功消息:
Retrieving http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.10.0-1.el7.ngx.x86_64.rpm warning: /var/tmp/rpm-tmp.Wy9IRo: Header V4 RSA/SHA1 Signature, key ID 7bd9bf62: NOKEY Preparing... ################################# [100%] Updating / installing... 1:nginx-1:1.10.0-1.el7.ngx ################################# [100%] ---------------------------------------------------------------------- Thanks for using nginx! Please find the official documentation for nginx here: * http://nginx.org/en/docs/ Commercial subscriptions for nginx are available on: * http://nginx.com/products/ ----------------------------------------------------------------------
安装成功后设为自动启动:
systemctl enable nginx