Wednesday, August 11, 2010

Installing apache mod_fastcgi(fastcgi module) on CentOS 5

In the previous post, I have written about installing apache mod_fcgid module to enable fastcgi support on apache. This time, I will write on how to install mod_fastcgi module to enable fastcgi module on apache installed on CentOS 5. Since by the time of this writing, there is no rpm for apache mod_fastcgi, we have to compile the mod_fastcgi module.

1. Install requirements for compilation
# yum install httpd-devel apr apr-devel libtool

2. Download latest mod_fastcgi source code
# cd /opt
# wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz

3. Untar the package.
# tar -xvzf mod_fastcgi-current.tar.gz

4. Install the module. You can find the installation guide on the INSTALL.AP2 file. We have to specify top_dir in the make and make install commands because we install apache2/httpd using yum
# cd mod_fastcgi-2.4.6
# cp Makefile.AP2 Makefile
# make top_dir=/usr/lib/httpd
# make install top_dir=/usr/lib/httpd

5. Add "LoadModule fastcgi_module modules/mod_fastcgi.so" to /etc/httpd/conf/httpd.conf to tell apache to load the new module

6. Restart apache
# /etc/init.d/httpd restart

7. You can assure that the mod is loaded by apache2, by looking at /var/log/httpd/error_log
# grep -i "FastCGI" /var/log/httpd/error_log 

[Wed Aug 11 12:26:27 2010] [notice] FastCGI: process manager initialized (pid 8853)

That's all :)

Installing apache mod_fcgid(fastcgi module) on CentOS 5

For apache to support FastCGI, you have to install either mod_fastcgi or mod_fcgid. In this example, I will show how to install mod_fcgid on existing apache webserver on centos 5.

First of all, the rpm is available at kbsingh's centos testing repository.To install kbsingh's centos repository:

1. Download kbsingh-CentOS-Extras.repo to /etc/yum.repos.d/
# cd /etc/yum.repos.d
# wget http://centos.karan.org/kbsingh-CentOS-Extras.repo

2. Enable karansingh's testing repo by setting gpgcheck to 0 and enabled to 1 in the [kbs-CentOS-Testing]
# sed -i "s/enabled=0/enabled=1/g" /etc/yum.repos.d/kbsingh-CentOS-Extras.repo

3. Install mod_fcgid
# yum install mod_fcgid

4. Restart apache, and verify whether fcgid_module is available by using the second command below
# /etc/init.d/httpd restart
# httpd -t -D DUMP_MODULES

5. If the module is still not loaded, add "LoadModule fcgid_module modules/mod_fcgid.so" to your /etc/httpd/conf/httpd.conf, and restart apache.


That's all :)