1、 编译和安装 apr
#首先将apr-httpd.**.tar.gz复制到/usr/local/下,执行sudo tar zxvf apr-httpd.**.tar.gz
cd /usr/local/apr/
./configure --prefix=/usr/local/apr-httpd/
make
make install
2、 编译和安装 apr-util
cd /usr/local/apr-util
./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/
make
make install
3、编译安装pcre
cd /usr/local/pcre
./configure --prefix=/usr/local/pcre
make
make install
4、 配置 httpd
cd /usr/local/httpd-2.2.17
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/ --with-pcre=/usr/local/pcre/ --enable-module=so
make
make install
5 、照例make ,make install,然后到/root/soft/apache/bin目录里,执 行./apachectl start,启动httpd服务,在浏览器中输入127.0.0.1进行测试,可 以出来网页,但是提示403 Forbidden,因为我的www目录默认在/root/soft/apache/htdocs目录,该目录是root权限的目录,web用户是无权限访问的,修改apache/conf/httpd.conf。把DocumentRoot 修改为 /var/www/html (可以在var下面新建这些目录) ,同时还需要修改<Directory "/root/soft/apache/htdocs">至<Directory "/var/www/html/">,保存,执行apachectl restart,即可