编译调试Apache HTTP Server

1.下载

wget http://mirror.bjtu.edu.cn/apache//apr/apr-1.4.6.tar.gz

wget http://mirror.bjtu.edu.cn/apache//apr/apr-util-1.4.1.tar.gz

wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.2.22.tar.gz

2.编译

tar zxvf apr-1.4.6.tar.gz

cd apr-1.4.6

./configure --prefix=/usr/local/apr-httpd/

make

make install

tar zxvf apr-util-1.4.1.tar.gz

cd apr-util-1.4.1

./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/

make

make install

tar -zxvf httpd-2.2.22.tar.gz

cd httpd-2.2.22

./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/ CFLAGS="-g"

make

make install

注意:--prefix指定为apache目录时运行会到apache2目录下找http.conf文件,避免麻烦还是设置为/usr/local/apache2吧。

3.测试

修改

conf/httpd.conf

Listen 10.8.1.66:80

bin/apachectl -k start

在浏览器输入http://10.8.1.66

bin/apachectl -k stop

4.调试

gdb httpd

b ap_process_request

r -X -d /usr/local/apache2

[参考]

Compiling and Installing    http://httpd.apache.org/docs/2.2/install.html

Apache Debugging Guide  http://httpd.apache.org/dev/debugging.html

原文地址:https://www.cnblogs.com/tiantao/p/2490453.html