Skip to content

ceph/mod-proxy-fcgi

Repository files navigation

mod_proxy_fcgi for Apache 2.2 
=============================

Apache 2.4 shipped mod_proxy_fcgi as part of the core distribution. This git
repository provides a modified version backported to work with Apache 2.2 in
order to work on older distributions (eg. Red Hat Enterprise Linux 6).

Installing from EPEL
====================

If you are on RHEL 6 or derivatives (eg. CentOS 6), you can install a pre-built
version of this software from EPEL. Enable EPEL on your system
(https://fedoraproject.org/wiki/EPEL), then "yum install mod_proxy_fcgi".

Building from source
====================

Building from source can be a bit more technical.  
Additionally, a new LoadModule directive needs to be added to httpd configuration files.

You'll need the apxs utility, which ships in the Apache "devel" package
on Linux distributions. Install "httpd-devel" on Red Hat-based distros, and
"apache2-dev" on Debian-based distros.

Building from source on RHEL/CentOS 6
=====================================

To get the dependencies, source, compile, and install:

  yum install -y curl make autoconf gcc glibc-headers httpd-devel;
  curl -L https://github.com/ceph/mod-proxy-fcgi/archive/master.tar.gz | tar xz && cd mod-proxy-fcgi-master;
  cd mod-proxy-fcgi-master;
  autoconf;
  ./configure;
  make;
  make install;
  make clean;
  chmod 644 /usr/lib/apache2/modules/mod_proxy_fcgi.so;
  printf "LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so" > /etc/httpd/conf/httpd.conf;
  cd ..;
  rm -Rf mod-proxy-fcgi-master;

Building from source on Debian 7
================================

To get the dependencies, source, compile, and install:

  apt-get install -qy curl make autoconf gcc libc6-dev apache2-threaded-dev;
  curl -L https://github.com/ceph/mod-proxy-fcgi/archive/master.tar.gz | tar xz && cd mod-proxy-fcgi-master;
  cd mod-proxy-fcgi-master;
  ln -sf apxs2 /usr/bin/apxs;
  autoconf;
  ./configure;
  sed -i "s>top_srcdir\=>top_srcdir\=.>" Makefile;
  mkdir -p build;
  ln -sf /usr/share/apache2/build/instdso.sh build/instdso.sh;
  make;
  make install;
  make clean;
  chmod 644 /usr/lib/apache2/modules/mod_proxy_fcgi.so;
  printf "# Depends: proxy\nLoadModule proxy_fcgi_module /usr/lib/apache2/modules/mod_proxy_fcgi.so" > /etc/apache2/mods-available/proxy_fcgi.load;
  a2enmod proxy_fcgi;
  cd ..;
  rm -Rf mod-proxy-fcgi-master;
  rm /usr/bin/apxs;

Loading the module in Apache
============================

To load this module, you must add the main mod_proxy to your configuration,
then load mod_proxy_fcgi:

  LoadModule proxy_module modules/mod_proxy.so
  LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

and of course reload the httpd server after your changes.

Configuring Apache
==================

See the upstream Apache documentation
(https://httpd.apache.org/docs/2.4/mod/mod_proxy_fcgi.html) for details about
mod_proxy_fcgi.

In this backported version of the module, "ProxyPass" statements work on
Apache 2.2, but "SetHandler" statements do not work. Also, Apache 2.2's
mod_proxy only supports TCP sockets ("fcgi://"). You cannot use Unix domain
sockets ("unix://") with this backported version of mod_proxy_fcgi.

In other words, you should use the following type configuration:

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    LogLevel debug

    RewriteEngine On

    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

    SetEnv proxy-nokeepalive 1

    ProxyPass / fcgi://127.0.01:9000/
</VirtualHost>