Apache脚本备忘

#
# Installation script
#
# Prepare for compilation environment
yum install -y groupinstall "Development Tools"

# Create a build directory
mkdir -p /opt/install/httpd

# Prepare for compilation source
cd /opt/install/httpd
curl -o httpd-2.4.2.tar.gz http://apache.etoak.com//httpd/httpd-2.4.2.tar.gz
curl -o apr-1.4.6.tar.gz http://mirrors.axint.net/apache/apr/apr-1.4.6.tar.gz
curl -o apr-util-1.4.1.tar.gz http://mirrors.axint.net/apache/apr/apr-util-1.4.1.tar.gz
curl -o pcre-8.30.tar.gz ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz
tar -zxvf httpd-2.4.2.tar.gz
tar -zxvf apr-1.4.6.tar.gz
tar -zxvf apr-util-1.4.1.tar.gz
tar -zxvf pcre-8.30.tar.gz

# Install build dependencies
yum install -y pcre-devel
mv apr-1.4.6 httpd-2.4.2/srclib/apr
mv apr-util-1.4.1 httpd-2.4.2/srclib/apr-util

# Create a User Group
groupadd httpd
useradd -r -g httpd httpd

# Compile and deploy
cd httpd-2.4.2
./configure \
--prefix=/opt/server/web/httpd \
--bindir=/opt/server/web/httpd/bin \
--sbindir=/opt/server/web/httpd/bin \
--enable-mods-shared=all \
--with-included-apr \
--with-mpm=prefork
make
make install

# Postinstallation setup
cd /opt/server/web/httpd
chown -R httpd .
chgrp -R httpd .
chown -R root .
chown -R httpd htdocs

# Configuration
cp conf/httpd.conf conf/httpd.conf.bak
sed -i -e "s/User daemon/User http/" -e "s/Group daemon/Group http/" conf/httpd.conf
sed -i -e "s/ServerAdmin you@example.com/ServerAdmin support@telenavsoftware.com/" conf/httpd.conf
sed -i -e "s/#ServerName www.example.com:80/ServerName localhost:80/" conf/httpd.conf
cp bin/apachectl /etc/init.d/httpd
sed -i '/#!\/bin\/sh/a\# chkconfig: - 85 15\n# description: web server\n# processname: httpd\n# pidfile: /opt/server/web/httpd/logs/httpd.pid\n# config: /opt/server/web/httpd/conf/httpd.conf' /etc/init.d/httpd
chmod a+x /etc/init.d/httpd
##chkconfig --add httpd
##chkconfig --level 345 httpd on

# Additional
/etc/init.d/httpd start
/etc/init.d/httpd stop
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值