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

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/" 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 :)


Anonymous said...

Great instructions - clear and worked first time. Thanks!

Anonymous said...

Very good job.. it´s worked fine.
thanks a lot.

Anonymous said...

Don't forget if your using a 64bit OS then you will need to install it in /lib64/ ..

CyborgShadow said...

Easier instructions:

Please follow steps 1-7 in the following procedure.

Make sure that the following are installed:

Apache Development package (httpd-devel)
Apache Portable Runtime (apr)
Apache Portable Runtime Development package (apr-devel)
Apache Portable Runtime Utilities package (apr-util)
GNU Build toolchain (make, ld, ar, gcc, etc.)

Download the most recent mod_fcgid source from the Apache Foundation:

In a shell window, unpack the tarball and change directory to the unpack directory (should be named mod_fcgid-x.x.x, example: mod_fcgid-2.3.6).






make install

The 'make install' inserts a line into the httpd.conf file to load the newly built module:

LoadModule fcgid_module modules/

vpnuzer said...

Thank you so much for this wonderful post. It works great. Clear, and very Straight forward instructions.

Don Lapeno said...

-bash: ./configure.apxs: No such file or directory

and on main instructions:

mod_fastcgi-2.4.6]# make top_dir=/usr/lib/httpd
Makefile:12: /usr/lib/httpd/build/ No such file or directory
make: *** No rule to make target `/usr/lib/httpd/build/'. Stop.

Abhinav said...

Very clear and precise, works even after 3 years ! I was able to create a puppet script in 30 mins. for mod_fastcgi because of your clear instructions

David said...

Thanks buddy.
Works nice with Centos 6.4