yum 安装  nginx

手动执行

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

yum list

yum install nginx 

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

service nginx start

脚本执行:

#!/bin/bash

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

yum clean all

yum list

sleep 2

rpm -qa |grep nginx

yum remove nginx

yum  install nginx -y

service nginx start

chkconfig nginx on

/etc/init.d/nginx restart

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

service iptables save

/etc/init.d/iptables restart