(1)、安装依赖
依赖库直接使用yum安装
(2)编译安装nginx
(3)配置和启动
(4)修改防火墙规则
Centos的防火墙默认是打开的,需要添加相应的规则打开80端口。
a)在另外一台机器上测试端口,发现80端口不通
[root@localhost ~]# telnet 10.237.92.30 80
Trying 10.237.92.30...
telnet: Unable to connect to remote host: No route to host
b) Centos的防火墙默认是打开的,查看本机防火墙配置
[root@localhost ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt sourcedestination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt sourcedestination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt sourcedestination
c)打开80端口
d) 修改iptables配置文件
使用iptables命令增加的规则在重启之后就失效了,要想规则在重启之后任然有效,需要修改iptables配置文件/etc/sysconfig/iptables,增加下面的行,