I finally installed lighttpd for development with Rails, and it’s much faster (as expected).
Because it didn’t show up in Google, I’m posting the error I originally got:
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.3/lib/active_support/dependencies.rb:200:in `const_missing': uninitialized constant RailsFCGIHandler (NameError) from public/dispatch.fcgi:24
My problem was that I installed lighttpd, but not FastCGI. The solution:
sudo port selfupdate sudo port install fcgi sudo port install lighttpd sudo gem install fcgi
The gem gave a bunch of errors about not finding certain fcgi files…no worries.
Then, either run the normal
./script/server
and Rails 0.14.x will automatically start lighttpd for you, or do it manually for an older project by copying ./script/lighttpd and ./config/lighhtpd.config from Typo.
And there it is! lighttpd bliss and 26% faster development time!
I use DarwinPorts.
I also had to modify my .cshrc to include /opt/local/sbin:
setenv PATH ${PATH}:/opt/local/sbin
For bash, I think you would do
PATH=$PATH:/opt/local/sbin export PATH
I have fcgi and lighttpd installed from source, and script/server under the latest rails still loads webrick. Is there a solution for that?
I would see if you can run lighttpd apart from ./script/server.
Snatch the lighttpd.conf from Typo and try running ‘lighttpd -D -f config/lighttpd.conf’ manually. That might give you more information about what’s going wrong.
Adding /usr/local/sbin (default location from building from source) to $PATH solved the problem with script/server not loading lighttpd
Good to hear. It’s a little odd that they build it there, but once you have your PATH setup, you’re golden!
I’m the maintainer of the lighttpd port; I think the switch to /opt/local/sbin/ is something recent. I’m investigating the option of placing it back in bin/, but maybe the authors of lighttpd have a reason for wanting it in sbin?
If you’d like to follow lighttpd/darwinports developments, bookmark the lighttpd section on my blog.
I just followed your directions. Worked like a charm. I’ve been messing with Typo today and could have used the speed boost earlier.
This worked great. Man, installing Rails locally on OS X tiger has been nothing but problems, but this worked perfectly first time. Right on. After about a day and a half of work the whole development sandbox is in place. Now to actually code. :P
Thanks! :)
Where is the configuration step? Did you use lighttpd.conf?
Nevermind: I updated my rails install from v13.x to version 14 and found the answer. Beginning in the Rails version 14, there is tight integration with Lighttpd, including the startup script, conf file, log files, etc. Very nice work by the Rails team.
In case your setup is a mixture between DarwinPorts fcgi and non-ports ruby, here’s how to get gems to install the ruby bindings:
sudo gem install fcgi——with-fcgi-include=/opt/local/include—with-fcgi-lib=/opt/local/lib
Textile didn’t like my last comment… here is the command again