通过rpm 添加yum源
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
安装
yum -y install nginx
设置启动nginx同时以开机自动运行
systemctl start nginx.service
systemctl enable nginx.service
转自:https://www.cnblogs.com/Liang-jc/p/8137956.html