Lighttpd and FastCGI
This document will describe how to set Ruby on Rails and PHP up on lighttpd with fastcgi.
Installing lighttpd and fcgi
pacman -S lighttpd fcgi
Now you have lighttpd with fcgi support. If it was that what you wanted you're all set. People that want Ruby on Rails and/or php should continue.
pacman -S php
Now check if you got the php-cgi version by entering php-cgi --version
PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cgi-fcgi) (built: Nov 13 2007 20:03:00) Copyright (c) 1997-2007 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
If you get a similar output your php is installed successfully
Note : Please keep in mind if you receive errors like No input file found after attempting to access your php files then make sure /etc/php/php.ini has the directives enabled
cgi.fix_pathinfo=1 open_basedir = /home/:/tmp/:/usr/share/pear/:/another/path:/second/path
Considering you want to use Ruby on Rails I assume you have ruby installed. If not do so.
We need rubygems and ruby-fcgi. Check the AUR!
Install both rubygems and ruby-fcgi
sudo pacman -S rubygems
wget http://aur.archlinux.org/packages/ruby-fcgi/ruby-fcgi/PKGBUILD makepkg sudo pacman -U ruby-fcgi-x.x.x-x-xxx.pkg.tar.gz
Now we have rubygems. Let's get rails!
sudo gem install rails --include-dependencies sudo gem install fcgi --include-dependencies
If this fails, get the  and compile it yourself.
$ wget http://fastcgi.com/dist/fcgi.tar.gz $ tar zxvf fcgi.tar.gz $ cd fcgi-2.4.0 $./configure $ make # make install
And repeat the gem install.
Check if you have more than one fcgi.so
find /usr -name fcgi.so
If you have two, delete the one that doesn't have "/site_ruby/" in its path.
For documentation how to use Ruby on Rails please consult .
Configuration of /etc/lighttpd/lighttpd.conf
I only show those you should change. The config is well commented and documentation can be found on .
server.modules = ( "mod_access", "mod_fastcgi", "mod_accesslog" ) server.indexfiles = ( "dispatch.fcgi", "index.php" ) #dispatch.fcgi is rails specified server.error-handler-404 = "/dispatch.fcgi" #too fastcgi.server = ( ".fcgi" => ( "localhost" => ( "socket" => "/tmp/rails-fastcgi.socket", "bin-path" => "/path/to/rails/application/public/dispatch.fcgi" ) ), ".php" => ( "localhost" => ( "socket" => "/tmp/php-fastcgi.socket", "bin-path" => "/usr/bin/php-cgi" ) ) )
Prior to switch on the service, in order to get it fully functional, be sure to create the directory /var/run/lighttpd and set the access accordingly. The Lighttpd installation doesn't create it automatically.