hoodwink.d enhanced


Rails on Lighttpd (with FreeBSD Instructions) #

by why in inspect

Jason Hoffman of the red-friendly server farm TextDrive, has a thorough expository of one Apache-alternative in his Should I Consider Lighttpd? Leveraging his experience with Rails hosting, he weighs the feature set of lighttpd against his essentials for a Rails application.

I think the best analogy for lighttpd to Those Who Rail Against the Machine would “Webrick that does FastCGI”: a single lighttpd instance is easy to compile, configure and get running for a single Rails App (it took me less than 10 minutes to have Manuals running under lighttpd).

It’s especially promising that the lighttpd site itself has Ruby and Rails running! (See the right-hand column.)

The most exhaustive setup instructions can be found on this Rails on Debian howto. I’m just going to offer a few setup pointers on FreeBSD, assuming you have a Rails setup already.

 cd /usr/ports/www/ruby-fcgi
 make install
 cd /usr/ports/www/lighttpd
 make install

 # Add: lighttpd_enable="YES" 
 vim /etc/rc.conf

 cd /usr/local/etc
 cp lighttpd.conf.sample lighttpd.conf

 # Follow step '6c' in the Rails on Debian tutorial
 vim lighttpd.conf

 /usr/local/etc/rc.d/lighttpd.sh start

I love that it comes with some many Apache-a-likes. For example, mod_rewrite.

You know what would be cool? Ruby configuration. Complete Ruby configuration.

Update: Ensure you are running lighttpd-1.3.8 or higher, since the lighttpd’s support for spawning FastCGI processes was buggy or non-existent previous to that release.

said on 09 Feb 2005 at 09:01

It’s probably going to be easier for most people if they run lighttpd as themselves (although you’ll need to be on a port > 1024 of course). It means all the little fastcgi children run as you too, so you can kill them (or lighttpd) off when they misbehave…

Something like:

cp /usr/local/etc/lighttpd.conf.sample /path/to/rails/config/lighttpd.conf

then just run

lighttpd -f /path/to/rails/config/lighttpd.conf

on bsd you can do this in your crontab:

@reboot lighttpd -f /path/to/rails/config/lighttpd.conf

said on 06 Mar 2005 at 04:03

Note: The most current FreeBSD port of lighttpd (if you’re running stable) is not even version 1.3, so if you are getting wierd behavior and error messages on startup, make sure your ports tree is cvsup’d. I found that out the hard way.

said on 14 Mar 2005 at 13:01

nice page!

said on 17 Jun 2005 at 14:56

I’m fairly new to this but I thought someone else might find it useful as well. After reading what jonraphaelson had to say about cvsup I had to find out how to do that. Here is a good link that got me through it fairly painlessly.

Updating the Ports Tree

said on 01 Nov 2005 at 02:56

I like it. Do one for Apache2 next ;)

Comments are closed for this entry.