1.查看yum源中是否存在nginx

yum info nginx

2.如果没有nginx相关信息,需要添加nginx的yum源,有则直接执行第三步

yum install http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

然后再次查看就会发现相关nginx的信息

3.yum安装nginx

yum install nginx

4.设置开机启动nginx

chkconfig nginx on

5.nginx一些常用命令

1.启动nginx:
service nginx start
2.关闭nginx:
service nginx stop
3.重启nginx:
service nginx restart
4.查看nginx状态:
service nginx status