#!/bin/bash
#安装apache
yum -y install httpd*
#安装cronolog(切分日志管理)
yum -y install cronolog
#安装mod_python
yum -y install mod_python
#if [ ! -f "/mnt/source/httpd.worker.conf" ]; then
# echo "http.worker.conf not exist, then exit install"
# exit 1
#fi
#cp -f /mnt/source/httpd.worker.conf /etc/httpd/conf/httpd.conf
#开机启动
/sbin/chkconfig httpd on
#重启服务器
/sbin/service httpd restart
注意:
如果是在center OS的系统默认中,防火墙是没有开启80端口的。
#开启80端口
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
#开启22端口,这个需要开启,否则ssh无法登陆
/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT
#保存规则
/etc/rc.d/init.d/iptables save
#重启防火墙
service iptables restart
(如果没有设置开启启动防火墙,可以做以下设置:
A: /sbin/chkconfig iptables on
B: /sbin/service iptables on
)
#查看防火墙状态
service iptables status
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination