1. centos 安装 apache2.4
安装基础依赖:
# yum install gcc gcc-c++ glibc glibc-devel gd gd-devel zlib zlib-devel libtool-ltdl-devel flex autoconf automake
apache 需要依赖apr 和 apr-util、apr-iconv、pcre
所以还需要先安装 apr和apr-util、apr-iconv
# wget http://apache.fayea.com//apr/apr-1.5.2.tar.gz
# wget http://apache.fayea.com//apr/apr-util-1.5.4.tar.gz
# wget http://apache.fayea.com//apr/apr-iconv-1.2.1.tar.gz
# wget https://sourceforge.net/projects/pcre/files/pcre/7.9/pcre-7.9.zip
#
# tar xzvf apr-1.5.2.tar.gz
# tar xzvf apr-util-1.5.4.tar.gz
# tar xzvf apr-iconv-1.2.1.tar.gz
# cd apr-1.5.2
# ./configure --prefix=/usr/local/apr
# make
# make install
# cd ..
# cd apr-util-1.5.4
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make
# make insatll
# cd ..
# cd apr-iconv-1.2.1
# ./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr
# make
# make insatll
#
# 安装pcre
# unzip pcre-7.9.zip
# cd pcre-7.9
# ./configure --prefix=/usr/local/pcre
# make && make install
apache历史版本下载地址:
# wget http://archive.apache.org/dist/httpd/httpd-2.4.9.tar.gz
# tar xzvf httpd-2.4.9.tar.gz
# cd httpd-2.4.9
# ./configure --prefix=/usr/local/apache --enable-track-vars --enable-cgi --with-config-file-path=/usr/local/apache/conf --with-apr=/usr/local/apr -with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
# make
# make install
说明:enable-cgi 支持CGI;enable-track-vars 为启动cookie的get/post等追踪功能
将apache安装为系统服务
# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
# service httpd start