Can not restart lighttpd? Receiving strange errors with regards to fcgi

fastcgilighttpdruby-on-rails

I received the following error when I tried to restart lighttpd.

I'm running a rails application, and when I deploy a new version of the site I usually do

/etc/init.d/lighttpd restart

This used to always work, until today when I got the following error message. I don't understand what is causing any of this, as far as I know I don't even use PHP, my project is in rails

2010-10-05 20:57:03: (mod_fastcgi.c.1042) the fastcgi-backend /var/dei/rails/current/public/dispatch.fcgi failed to start:
2010-10-05 20:57:03: (mod_fastcgi.c.1046) child exited with status 1 /var/dei/rails/current/public/dispatch.fcgi
2010-10-05 20:57:03: (mod_fastcgi.c.1049) if you try do run PHP as FastCGI backend make sure you use the FastCGI enabled version.
You can find out if it is the right one by executing 'php -v' and it should display '(cgi-fcgi)' in the output, NOT (cgi) NOR (cli)
For more information check http://www.lighttpd.net/documentation/fastcgi.html#preparing-php-as-a-fastcgi-program
2010-10-05 20:57:03: (mod_fastcgi.c.1351) [ERROR]: spawning fcgi failed.
2010-10-05 20:57:03: (server.c.849) Configuration of plugins failed. Going down.



Debian Version: lenny/sid
Rails Version: Rails 2.3.5
Ruby Version: ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
Lighttpd: lighttpd-1.4.15 (ssl) - a light and fast webserver

Best Answer

I found the answer one this page. Here is the content below, in case the link ever goes dead.

Basically I needed to create a fastcgi.crash.log file with the appropriate write permissions and all my problems were solved.

lighttpd, fcgi, rails and child exited with status 9, 1, 2, 3 or X
By Giulio Turetta

Ok, these errors are not good. They didn’t tell much about what happended.
But you can’t do as I did. Don’t wander on the dark side of the system…
Just try to execute your FCGI as your lighttpd did.
Find your lighttpd user in lighttpd configuration file (debian: /etc/lighttpd/lighttpd.conf).
On my configuration I see:
server.username  = “www-data”

so…

$ su
# cd /my_rails_root/public
# sudo -u www-data ./dispatch.fcgi

Read what’s happen and solve.
That’s all! 
Related Topic