cd /etc/yum.repos.d/
vim //添加yum源
[nginx]
name=nginx
repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
w nginx.repo
yum install nginx
vim /etc/sysconfig/iptables //默认没开启80端口
-A INPUT –m state –-state NEW –m tcp –p tcp –-dport 80 –j ACCEPT //在22端口下添加这一行
/etc/init.d/iptables restart //重启防火墙
/etc/init.d/nginx start //开启nginx
附:nginx命令
停止nginx服务:# /etc/init.d/nginx stop
启动nginx服务:# /etc/init.d/nginx start
编辑nginx配置文件:# vim /etc/nginx/nginx.conf
参考文献:http://www.cnblogs.com/highend/archive/2013/03/06/centos6_3_install_nginx_1_2_7.html