When using the [P] flag in a RewriteRule
to proxy, you would normally be able to use the ProxySet
directive to set the options normally configured via ProxyPass
.
But in this case you do not have a specific proxy URL to configure. If you are only proxying user accounts, you could do something like:
ProxyPassMatch /\w+/ http://$1.myhostname.com/ keeplive=on
Although from your example it seems it's possible different domains are in use (hence the use of a RewriteMap
).
Alternatively, another thought that just occurred, it might work to use the following (untested):
<Proxy *>
ProxySet keepalive=on
</Proxy>
You can build httpd-2.4 from source, first of all you need to upgrade apr/apr-util to at least 1.3.0
checking for APR version 1.3.0 or later... yes
checking for APR-util version 1.3.0 or later... yes
Build and install apr-1.4.8
# ./configure --prefix=/opt/apr-1.4.8
# make
# make install
Build and install apr-util-1.5.2
# ./configure --prefix=/opt/apr-util-1.5.2 --with-apr=/opt/apr-1.4.8/ --with-crypto --with-openssl=/usr --with-ldap --with-ldap-include=/usr/include/ --with-ldap-lib=/usr/lib64/
# make
# make install
Build and install apache-2.4.6
# ./configure --prefix=/opt/httpd-2.4.6 --with-apr=/opt/apr-1.4.8/ --with-apr-util=/opt/apr-util-1.5.2/
# make
# make install
I would suggest do not touch system apr/apr-util packages
Some basic checks
# lsof -n -P -i tcp:8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 29268 root 4u IPv4 57621 0t0 TCP 127.0.0.1:8080 (LISTEN)
httpd 29269 daemon 4u IPv4 57621 0t0 TCP 127.0.0.1:8080 (LISTEN)
httpd 29270 daemon 4u IPv4 57621 0t0 TCP 127.0.0.1:8080 (LISTEN)
httpd 29273 daemon 4u IPv4 57621 0t0 TCP 127.0.0.1:8080 (LISTEN)
# cat /proc/29268/cmdline
/opt/httpd-2.4.6/bin/httpd
# /opt/httpd-2.4.6/bin/httpd -V
Server version: Apache/2.4.6 (Unix)
Server built: Aug 30 2013 14:33:24
Server's Module Magic Number: 20120211:23
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/opt/httpd-2.4.6"
-D SUEXEC_BIN="/opt/httpd-2.4.6/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
# lsof -n -P -i tcp:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 29392 root 4u IPv4 58386 0t0 TCP *:80 (LISTEN)
httpd 29394 apache 4u IPv4 58386 0t0 TCP *:80 (LISTEN)
httpd 29395 apache 4u IPv4 58386 0t0 TCP *:80 (LISTEN)
httpd 29396 apache 4u IPv4 58386 0t0 TCP *:80 (LISTEN)
httpd 29397 apache 4u IPv4 58386 0t0 TCP *:80 (LISTEN)
httpd 29398 apache 4u IPv4 58386 0t0 TCP *:80 (LISTEN)
httpd 29399 apache 4u IPv4 58386 0t0 TCP *:80 (LISTEN)
httpd 29400 apache 4u IPv4 58386 0t0 TCP *:80 (LISTEN)
httpd 29401 apache 4u IPv4 58386 0t0 TCP *:80 (LISTEN)
# cat /proc/29392/cmdline
/usr/sbin/httpd
# /usr/sbin/httpd -V
Server version: Apache/2.2.3
Server built: Aug 13 2013 13:27:54
Server's Module Magic Number: 20051115:3
Server loaded: APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture: 64-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=128
-D HTTPD_ROOT="/etc/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"
I know that build packages from source it's a bad idea, but sometimes it is the only way out
Best Answer
There's new feature to 2.4 called reqtimeout_module. You have to comment all the statements in /etc/apache2/mods-available/reqtimeout.conf and restart the server.
You can also check http://httpd.apache.org/docs/current/mod/mod_reqtimeout.html for more detailed info.