Friday, April 13, 2007

Went for mod_fcgid instead of mod_fastcgi

Getting the module
 
# wget http://prdownloads.sourceforge.net/mod-fcgid/mod_fcgid.2.1.tar.gz?download


Need to fix Makefile so it point to /usr/share/apache2 and add copy couple of the libraries from /usr/include/apache2-prefork to /usr/include/apache2: mpm.h and mpm_common.h to avoid this error:


# /tmp/mod_fcgid.2.1 # make
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -I. -O2 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -g -fPIC -Wall -fno-strict-aliasing -DLDAP_DEPRECATED -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -DAP_DEBUG -DSSL_EXPERIMENTAL_ENGINE -DMAX_SERVER_LIMIT=200000 -DLDAP_DEPRECATED -DMAXLINE=4096 -I/usr/include/apache2 -I. -I/usr/include/apr-1 -prefer-pic -c arch/unix/fcgid_proc_unix.c && touch fcgid_proc_unix.slo
In file included from arch/unix/fcgid_proc_unix.c:13:
/usr/include/apache2/mpm_common.h:46:17: error: mpm.h: No such file or directory
In file included from arch/unix/fcgid_proc_unix.c:13:
/usr/include/apache2/mpm_common.h:349: error: expected ')' before '*' token
make: *** [fcgid_proc_unix.slo] Error 1


So it make:

# make
# strip .libs/mod_fcgid.so
# make install


This has to be added to httpd.conf:

This is for fastcgi-mode Ruby on Rails ( Thank Andre Nathan giving me this demo configuration )

LoadModule fcgid_module modules/mod_fcgid.so
SocketPath /tmp/fcgidsock
SharememPath /tmp/fcgidshm
DefaultInitEnv RAILS_ENV production

<Directory /home/sneakymustard/tumble/public>

    Options ExecCGI FollowSymLinks

    AllowOverride AuthConfig Indexes Limit

    Order allow,deny


    Allow from all



    AddHandler fcgid-script .fcgi


    # You need
mod_fcgid version >= 2.1 to support arguments "xxx/dispatch.fcgi" in
FCGIWrapper

    FCGIWrapper "/usr/bin/ruby
/home/sneakymustard/tumble/public/dispatch.fcgi" .fcgi



    RewriteEngine On


    RewriteRule ^$ index.html [QSA]

    RewriteRule ^([^.]+)$ $1.html [QSA]

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

</Directory>


along with

AddHandler fastcgi-script fcgi

<Directory /srv/www/htdocs/>
AllowOverride All
Options FollowSymLinks
</Directory>

<Directory /srv/www/rails/*/public/>
Allow from all
</Directory>


and

SocketPath /tmp/fcgidsock
AddHandler fcgid-script fcgi


Edit the
APACHE_MODULES
line in
/etc/sysconfig/apache2
by inserting “fcgid” and removing “fastcgi”.

HOORAY!

1 comment:

Robert Brewer said...

I saw this listed as a way to get up and running with Rails on Linux. Probably not relevant since you fixed your problem, but for others:

RailsLiveCD