Moving to Lighttpd from Apache 1
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
If you’ve been hosting your app with Textdrive using Apache and FastCGI, you may have noticed that FastCGI seems to crash every few minutes with these kinds of error messages:
[Mon Aug 08 03:40:25 GMT 2005] Dispatcher failed to catch: SIGHUP (SignalException)
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each’
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi’
dispatch.fcgi:18
FCGI process 28217 killed by this error
[Mon Aug 08 04:07:55 GMT 2005] Dispatcher failed to catch: exit (SystemExit)
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:10:in `exit’
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:10
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:10:in `call’
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each’
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in `each_cgi’
dispatch.fcgi:18
FCGI process 38625 killed by this error
These crashes really don’t have _that_ much of an effect on your website, except that the next visitor to your website will have to wait a few seconds before anything appears while the web server caches some information. But my Ruby on Rails website gets quite a bit of traffic, so this happens to visitors every 5 minutes throughout the day.
So, I decided to move to Lighttpd from Apache, which should stop these types of errors from occuring.
The Lighttpd setup was extremely painless and I had everything setup within 30 minutes. The first step is to send a ticket to the support staff at Textdrive, requesting them to setup a Lighttpd port for you. In the reply from the Textdrive support staff, they’ll reference a couple great webpages that contain Lighttpd tutorials to follow. Specifically I followed these tutorials:
- http://wiki.rubyonrails.com/rails/show/DeployingApplicationOnTextdrive
- http://jlaine.net/blog/48/running-your-own-lighttpd-on-textdrive-and-keeping-it-alive-too-part-i
On the Deploying Application On Textdrive wiki page, skip halfway down the page and check out the section called Lighttpd For Idiots. This is a great tutorial that will get you nearly complete. (I did find one small problem with this tutorial though. When I ran the lighttpd command over SSH to start up the Lighttpd server, I got an error message saying that my lyricsdb.socket file didn’t exist. To fix this problem, just create a tmp/ folder in the lighttpd/ folder.
On you’ve completed this tutorial, head to the 2nd webpage that I linked to above. The 2nd link shows you how to set up a cron job so that your Lighttpd server starts every time the webserver is restarted.
Now, my Ruby on Rails website is being served by Lighttpd. I just hope that I didn’t miss anything, considering that my app was initially running over Apache and FastCGI. Do I need to turn anything off that I may have turned on to get Apache and FastCGI going in the first place?
Thanks for the info Rory,
I’d been having the same trouble with my rails app on Mac OS X 10.3 Server and Apache – but moving over to lighttpd seems to have solved it.
In case anyone else is interested in installing lighttpd on OS X try this excellent tutorial:
http://theexciter.com/articles/installing-lighttpd-on-osx