How to compile mod_proxy module additionally while the Apache httpd is running

Jephe Wu - http://linuxtechres.blogspot.com

Environment: CentOS 4.4 32bit web server,  Apache web server is running within chroot environment, it's also Cognos web gateway server.
Objective: we need to enable mod_proxy module to use reverse proxy method  instead of using web gateway method to make httpd to take to Cognos server on application network segmen. (As somehow the cognos web gateway is not able to take to Cognos server anymore unless using reverse proxy method)

Tried to use apxs to compile mod_proxy.c and mod_proxy_http.c, it's not working.


Steps:
1.  find out the apache httpd version first
cd /usr/local/chroot/usr/local/apache2
bin/httpd -V


2. find out the original compiling options
cd /usr/local/chroot/usr/local/apache2/build
cat config.nice

[root@web1 build]# more config.nice
#! /bin/sh
#
# Created by configure

"./configure" \
"--prefix=/usr/local/apache2" \
"--enable-mods-shared=all" \
"--enable-ssl=shared" \
"--enable-rewrite=shared" \
"--enable-headers=shared" \
"--enable-expires=shared" \
"--enable-cern-meta=shared" \
"--enable-unique-id=shared" \
"--enable-mime-magic=shared" \
"--with-ssl=/usr/local/ssl" \
"$@"

3. find where the original Apache httpd installation files are, then compile mod_proxy.

"./configure" "--prefix=/usr/local/apache2_test" "--enable-mods-shared=all" "--enable-ssl=shared" "--enable-rewrite=shared" "--enable-proxy=shared" "--enable-headers=shared" "--enable-expires=shared" "--enable-cern-meta=shared" "--enable-unique-id=shared" "--enable-mime-magic=shared" "--with-ssl=/usr/local/ssl" "$@"

use different installation prefix directory, then run 'make;make install' to install everything into /usr/local/apache2_test.

4. copy necessary mod_proxy modules into /usr/local/chroot/usr/local/apache2/modules/

cd /usr/local/chroot/usr/local/apache2/modules/
cp /usr/local/apache2_test/modules/mod_proxy.so .
cp /usr/local/apache2_test/modules/mod_proxy_http.so .


5. modify /usr/local/chroot/usr/local/apache2/conf/httpd.conf to enable mod_proxy

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule proxy_connect_module modules/mod_proxy_connect.so
#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so



6. configure virutalhost to enable mod_proxy directives

    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
    RewriteRule .* - [F]

rewriterule ^/reporting/(.*) http://10.0.0.1/cognos8/$1 [P,L]
rewriterule ^/cognos8/(.*) http://10.0.0.1/cognos8/$1 [P,L]



7. use USR1 to kill Apache parent process
ps -efH to find out the parent process id
then kill -USR1 thatid
ps -efH to check again.