#================= Install apache 2.4.2 ==============#
- /usr/sbin/groupadd www
- /usr/sbin/useradd -g www www -s /sbin/nologin
- mkdir -p /data/www/{kerry,king}
- mkdir -p /data/logs/{kerry,king}
- chown -R www:www /data/www
- chown -R www:www /data/logs
- cd /opt
- wget http://ftp.gnu.org/gnu/libtool/libtool-2.4.2.tar.gz
- rpm -e libtool-1.5.22-7.el5_4
- tar -zxvf libtool-2.4.2.tar.gz
- cd libtool-2.4.2
- ./configure
- make;make install
- tar -jxvf pcre-8.30.tar.bz2
- cd pcre-8.30
- ./configure --prefix=/usr/local/pcre
- make;make install
- cd ../
- tar -jxvf httpd-2.4.2.tar.bz2
- tar -jxvf httpd-2.4.2-deps.tar.bz2
- cd httpd-2.4.2
#隐藏apache版本信息
- sed -i 's/#define AP_SERVER_BASEPRODUCT "Apache"/#define AP_SERVER_BASEPRODUCT "Microsoft-IIS 5.0"/' include/ap_release.h
- sed -i 's/#define PLATFORM "Unix"/#define PLATFORM "win32"/' os/unix/os.h
- ./configure --prefix=/usr/local/apache \
- --enable-deflate \
- --enable-headers \
- --enable-mime-magic \
- --enable-proxy \
- --enable-ssl \
- --enable-so \
- --enable-rewrite \
- --enable-suexec \
- --with-suexec-bin=/usr/sbin/suexec \
- --with-suexec-caller=www \
- --with-pcre=/usr/local/pcre/bin/pcre-config \
- --with-mpm=prefork \
- --with-ssl=/usr
- make;make install
#make的时候报错,“/usr/lib/libexpat.so: could not read symbols: File in wrong format”
#解决方法:
\cp /usr/lib64/libexpat.* /usr/lib/
#配置自启动文件
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
#在首行#!/bin/sh下添加
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache/logs/httpd.pid
# config: /usr/local/apache/conf/httpd.conf
#或者直接使用sed添加
- sed -i '/#!\/bin\/sh/a\# chkconfig: - 85 15\n# description: web server\n# processname: httpd\n# pidfile: /usr/local/apache/logs/httpd.pid\n# config: /usr/local/apache/conf/httpd.conf' /etc/init.d/httpd
