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

8 comments:

  1. AnonymousMay 25, 2011

    Great instructions - clear and worked first time. Thanks!

    ReplyDelete
  2. AnonymousJune 03, 2011

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

    ReplyDelete
  3. AnonymousJuly 14, 2011

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

    ReplyDelete
  4. 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:

    http://httpd.apache.org/download.cgi#mod_fcgid

    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).

    Run:

    ./configure.apxs

    Run:

    make

    Run:

    make install

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

    LoadModule fcgid_module modules/mod_fcgid.so

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

    ReplyDelete
  6. Don LapenoJune 03, 2012

    -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/special.mk: No such file or directory
    make: *** No rule to make target `/usr/lib/httpd/build/special.mk'. Stop.

    ReplyDelete
  7. 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

    ReplyDelete
  8. Thanks buddy.
    Works nice with Centos 6.4

    ReplyDelete