前EMC高级软件工程师,现小米分布式存储码农,关注分布式存储,文件系统,Linux内核。微博: http://weibo.com/u/2203007022
分类: 系统运维
2014-04-27 21:36:36
[root@localhost ~]# yum -y install gcc gcc-c++ automake autoconf libtool makeb) 安装prec
[root@localhost ~]# yum install pcre.x86_64 pcre-devel.x86_64c) 安装zlib
[root@localhost ~]# yum install zlib.x86_64 zlib-devel.x86_64d) 安装openssl
[root@localhost ~]# yum install openssl.x86_64 openssl-devel.x86_64
[root@localhost ~]# wgetb) 解压
[root@localhost ~]# tar -xvf nginx-1.4.7.tar.gz [root@localhost ~]# cd nginx-1.4.7c) 安装 i. 指定安装目录
[root@localhost ~]# ./configure --prefix=/usr/local/nginx/cache/ii. make & make install
[root@localhost ~]# make [root@localhost ~]# make install
[root@localhost ~]# netstat –nltp | grep 80b) root启动nginx,
[root@localhost ~]# /usr/local/nginx/cache/sbin/nginx -c /usr/local/nginx/cache/conf/nginx.conf
[root@localhost ~]# telnet 10.237.92.30 80 Trying 10.237.92.30... telnet: Unable to connect to remote host: No route to hostb) Centos的防火墙默认是打开的,查看本机防火墙配置
[root@localhost ~]# service iptables status Table: filter Chain INPUT (policy ACCEPT) num target prot opt source destination 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 source destination 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 source destinationc) 打开80端口
[root@localhost ~]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT查看端口会发现端口通了
guojun1@guojun1-OptiPlex-9020:~$ telnet 10.237.92.30 80 Trying 10.237.92.30... Connected to 10.237.92.30. Escape character is '^]'. ^]d) 修改iptables配置文件 使用iptables命令增加的规则在重启之后就失效了,要想规则在重启之后任然有效, 需要修改iptables配置文件/etc/sysconfig/iptables,增加下面的行,
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT