rpm包搭建apache的shell脚本

 #!/bin/bash

echo "######welcome to install http server#########"
yum -y remove httpd*
yum -y install httpd*
IP=`ifconfig | grep -A 1 "^eth" | grep -o "addr:[0-9.]\{1,\}" | cut -d: -f2`
CONF=/etc/httpd/conf/httpd.conf
VHOST_CONF=/etc/httpd/vhost/vhost.conf
echo "ServerName $IP:80" >> $CONF
echo "Include vhost/vhost.conf" >> $CONF
mkdir -p /data/web
mkdir -p /data/web/test01
mkdir -p /data/web/test02
mkdir /etc/httpd/vhost
touch /etc/httpd/vhost/vhost.conf
cat >> $VHOST_CONF << EOF
Alias /test01 "/data/web/test01/"
<Directory "/data/web/test01">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
Alias /test02 "/data/web/test02/"
<Directory "/data/web/test02">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
EOF
echo "this is test01 website welcome" >> /data/web/test01/index.html
echo "this is test02 website welcome" >> /data/web/test02/index.html
service httpd restart
iptables -F
setenforce 0









本文转自 jie783213507 51CTO博客,原文链接:http://blog.51cto.com/litaotao/1186913,如需转载请自行联系原作者
上一篇:HttpServletResponse和HttpServletRequest中的一些方法


下一篇:rhel 4/oracle linux 4/centos linux 4 配置本地yum资源库