#!/bin/bash
#切换到app目录并解压文件
cd /app
unzip /app/httpdConfig.zip
chown -R app:app /app/httpdConfig
#切换到解压目录
#解压、编译安装pcre插件
cd /app/httpdConfig
tar -xvf /app/httpdConfig/pcre-8.38.tar.gz
cd /app/httpdConfig/pcre-8.38
/app/httpdConfig/pcre-8.38/configure --prefix=/usr/local/pcre && make && make install
chown -R app:app /app/httpdConfig/pcre-8.38
#切换到解压目录
#解压
cd /app/httpdConfig
tar -xvf httpd-2.4.23.tar.gz
#解压apr与apr-util,并修改名字
#复制apr与apr-util到httpd的srclib目录
tar -xvf apr-1.5.2.tar.gz
mv apr-1.5.2 apr
tar -xvf apr-util-1.5.4.tar.gz
mv apr-util-1.5.4 apr-util
mv /app/httpdConfig/apr /app/httpdConfig/httpd-2.4.23/srclib/apr
mv /app/httpdConfig/apr-util /app/httpdConfig/httpd-2.4.23/srclib/apr-util
#编译安装httpd
cd /app/httpdConfig/httpd-2.4.23
/app/httpdConfig/httpd-2.4.23/configure --prefix=/usr/local/httpd --with-pcre=/usr/local/pcre && make && make install
chown -R app:app /app/httpdConfig/httpd-2.4.23
#修改httpd配置文件
cp /app/httpdConfig/httpd.conf /usr/local/httpd/conf/httpd.conf
chown -R app:app /usr/local/httpd
#注册httpd的服务
cp /app/httpdConfig/httpd /etc/init.d/httpd
chmod a+x /etc/init.d/httpd
chkconfig --add /etc/init.d/httpd
#chkconfig httpd on
#删除解压目录
rm -rf /app/httpdConfig