1. 查看yum源中yum info nginx 版本
yum info nginx
# 没有nginx或者nginx版本比较低,则设置新的nginx的yum源
yum install http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
# 安装成功后查看nginx版本。
yum info nginx
2 . yum安装nginx
yum install nginx
3. 设置nginx开机启动
chkconfig nginx on
4. nginx 启动关闭
# 启动
service nginx start
# 关闭
service nginx stop