访问nginx官方站点,根据系统版本和需求下载nginx的Linux packages

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

rpm –ivh ./nginx-release-centos-6-0.el6.ngx.noarch.rpm

yum install nginx

/etc/init.d/nginx start

chkconfig nginx on

安装完成后设置防火墙允许80端口例外以便能正常对外提供web服务。

编辑/etc/sysconfig/iptables 在22端口的规则下面增加一条

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

linux下nginx的源设置请参考:

http://nginx.org/en/linux_packages.html#stable