在非root用户下安装Apache
1. 首先在 http://httpd.apache.org/ 获取到 httpd-2.4.10.tar.gz
2. 安装
(1)tar -zxvf httpd-2.4.10.tar.gz
(2)cd httpd-2.4.10
(3)./configure--prefix=/home/work/local/apache2 --enable-so --enable-proxy --enable-proxy-http--enable-proxy-balancer --enable-modules=all --enable-mods-shared=all--with-pcre=/home/work/local/pcre4
不需要指定apr ,apr apr-util需要安装在一个路径下否则make失败
(4)make
make时候提示 APR Not Found or APR version 太低。
(5)make install
(一)APR Not Found
1.获取软件
wget http://archive.apache.org/dist/apr/apr-1.5.1.tar.gz
2.安装
(1)tar -zxf apr-1.5.1.tar.gz
(2) cd apr-1.5.1
(3)./configure --prefix=/home/work/local/apr
(4)make && make install
3. 设置环境变量PATH,添加APR的路径
export APR_HOME=/home/work/local/apr
export PATH=$APR_HOME/bin:$PATH
(二)安装对应的APR-Util
1.获取软件
wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
2.安装
(1)tar -zxf apr-util-1.5.4.tar.gz
(2)cd apr-util-1.5.4
(3)这部很重要,否则后面Apache编译时候报错重复定义"exports.c:1572: error: redefinition of `ap_hack_apr_allocator_create' "
./configure -prefix=/home/work/local/apr -with-apr=/home/work/local/apr/bin/apr-1-config
(4)make && make install
(三)PCRE安装
1.获取软件
wgethttp://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
2.安装
(1)unzip -o pcre-8.10.zip
(2)cd pcre-8.10
(3)./configure --prefix=/home/work/local/pcre
(4)make && make install
3.设置环境变量PATH ,添加pcre路径
export PCRE_HOME=/home/work/local/pcre
export PATH=$PCRE_HOME/bin:$PATH
(四)Apache配置注意事项
1. 解决URL Rewriting Apache and mod_rewrite (and .htaccess)
在htdocs下增加服务或其它任何目录下增加服务:
参见http://book.cakephp.org/2.0/en/installation/url-rewriting.html