在同一台服务器上同时安装并运行apache2.2和apache2.4

我们需要在同一个VM上运行Apache 2.2和Apache 2.4 Web服务器。 需求由以下创build:

  • 要求托pipe一个不支持Apache 2.4的Oracle WebGate模块(我们使用Red Hat提供的2.2 httpd)
  • 与WebGate处理关联使用Apache 2.4本地会话的要求
  • 对我们可以使用的虚拟机数量的限制(要求两个虚拟机都在同一个虚拟机上)

这一切都必须在RHEL 5.8 VM上进行(请注意,RHEL5没有适用于Apache 2.4的Red Hat RPM(实际上也不是6)。 我们的一般意图是让2.2实例作为localhost-port-listening 2.4实例的反向代理(本身充当我们原始服务器的反向代理)。 configuration避免端口冲突,处理代理等是不是一个问题,我很熟悉这样的。 在不确定的情况下,同时安装和运行两个服务器版本是一般的方法。

有没有人做过这个? 如果是这样,你的一般方法是什么? 这两个版本安装在一起干净地工作,还是你必须例如chroot一个创build图书馆之间的分离? 还是你静态链接2.4二进制文件所需的一切,或者什么? 我们在执行模式下运行SELinux – 是否有任何意义要在这方面意识到?

对于那些做过类似事情的人,我在Google上空着空洞,希望有人在这里。

谢谢!

您可以从源代码构buildhttpd-2.4,首先您需要将apr / apr-util升级到至less1.3.0

checking for APR version 1.3.0 or later... yes checking for APR-util version 1.3.0 or later... yes 

构build并安装apr-1.4.8

 # ./configure --prefix=/opt/apr-1.4.8 # make # make install 

构build并安装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立并安装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 

我build议不要触摸system apr / apr-util软件包

一些基本的检查

 # 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" 

我知道从源代码构build包是一个坏主意,但有时候这是唯一的出路