Trouble with Lighty

I’m trying to setup my rails application with Light+fcgi.

This is the error I’m getting when I try to start Lighttpd :

============
[getcapture@alpha getcapture]$ ~/etc/rc.d/lighttpd.sh start
Starting Lighttpd
2006-04-15 11:27:24: (mod_fastcgi.c.1022) execve failed for:
/home/getcapture/application/public/dispatch.fcgi No such file or
directory
[getcapture@alpha getcapture]$ 2006-04-15 11:27:24:
(mod_fastcgi.c.1048) the fastcgi-backend
/home/getcapture/application/public/dispatch.fcgi failed to start:
2006-04-15 11:27:24: (mod_fastcgi.c.1052) child exited with status 2
/home/getcapture/application/public/dispatch.fcgi
2006-04-15 11:27:24: (mod_fastcgi.c.1055) 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
2006-04-15 11:27:24: (mod_fastcgi.c.1060) If this is PHP on Gentoo add
fastcgi to the USE flags
2006-04-15 11:27:24: (mod_fastcgi.c.1356) [ERROR]: spawning fcgi failed.
2006-04-15 11:27:24: (server.c.834) Configuration of plugins failed.
Going down.

I’m not giving relative path to lighttpd.conf here. Other useful
information might be :

============
[getcapture@alpha getcapture]$ ls -al
/home/getcapture/application/public/dispatch.fcgi
-rwxr-xr-x 1 getcapture getcapture 879 Apr 15 11:06
/home/getcapture/application/public/dispatch.fcgi

[getcapture@alpha getcapture]$ cat
/home/getcapture/application/public/dispatch.fcgi
#!/usr/bin/ruby

[getcapture@alpha getcapture]$ /usr/bin/ruby -v
ruby 1.8.4 (2005-12-24) [i686-linux]

fastcgi.server = ( “.fcgi” =>
( “localhost” =>
( “socket” => base + “/var/run/application.socket”,
“min-procs” => 1,
“max-procs” => 2,
“bin-path” => base + “/application/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “production” )
)
)
)

Using Rails 1.1.2 and Lighttpd 1.4.11.

Please help !

Thanks,
Pratik

http://www.freeonrails.com - Free as in beer !

Pratik Naik wrote:

I’m trying to setup my rails application with Light+fcgi.

This is the error I’m getting when I try to start Lighttpd :

snip

http://www.lighttpd.net/documentation/fastcgi.html#preparing-php-as-a-fastcgi-program
2006-04-15 11:27:24: (mod_fastcgi.c.1060) If this is PHP on Gentoo add
fastcgi to the USE flags
2006-04-15 11:27:24: (mod_fastcgi.c.1356) [ERROR]: spawning fcgi failed.
2006-04-15 11:27:24: (server.c.834) Configuration of plugins failed.
Going down.

I’m not giving relative path to lighttpd.conf here.

Are you trying to use PHP and Rails with lighttpd?

If so you may check this out:
http://www.urbanpuddle.com/articles/2006/03/17/setting-up-a-mixed-ruby-on-rails-dev-environment

There’s a sample lighttpd.conf file too.

Nop. I’m not trying to use php. It’s pure rails.

On 4/15/06, Vince W. [email protected] wrote:

2006-04-15 11:27:24: (mod_fastcgi.c.1356) [ERROR]: spawning fcgi failed.
http://www.urbanpuddle.com/articles/2006/03/17/setting-up-a-mixed-ruby-on-rails-dev-environment

There’s a sample lighttpd.conf file too.


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


http://www.freeonrails.com - Free as in beer !

Pratik Naik wrote:

Nop. I’m not trying to use php. It’s pure rails.

Hmm… from the errors it looks like you are trying to use php too. Try
this:

Rails site, I want this on www or no www

$HTTP[“host”] =~ “(www.)?mysite.com” {
server.port = 80
server.document-root = “/var/www/mysite/public”
server.error-handler-404 = “/dispatch.fcgi”
server.indexfiles = ( “index.php”, “index.html”, “index.htm”,
“default.htm” )
url.rewrite = ( “^/$” => “index.html”, “^([^.]+)$” => “$1.html” )
fastcgi.server = (
“.fcgi” => (
“localhost” => (
“socket” => “log/fcgi.socket”,
“bin-environment” => ( “RAILS_ENV” => “production” ),
“bin-path” => “public/dispatch.fcgi”,

“max-load-per-proc” => 4,

     "min-procs" => 1,
     "max-procs" => 2

“idle-timeout” => 60

 )

Pratik Naik wrote:

No success :frowning: I even tried the default lighttpd.conf of rails 1.1.2.
Even that gives the same error.

Thanks for your time,
Pratik

Can you post your entire lighttpd.conf file?

No success :frowning: I even tried the default lighttpd.conf of rails 1.1.2.
Even that gives the same error.

Thanks for your time,
Pratik

On 4/15/06, Vince W. [email protected] wrote:

server.document-root = “/var/www/mysite/public”

“max-load-per-proc” => 4,

http://lists.rubyonrails.org/mailman/listinfo/rails


http://www.freeonrails.com - Free as in beer !

Here we go :

BetterLabs.net - Lighty Configuration File

server.modules = ( “mod_rewrite”,
“mod_redirect”,
“mod_access”,
“mod_cgi”,
“mod_fastcgi”,
“mod_compress”,
“mod_accesslog” )

cgi.assign = ( “.pl” => “/usr/bin/perl”,
“.cgi” => “/usr/bin/perl” )

mimetype.assign = (
“.pdf” => “application/pdf”,
“.sig” => “application/pgp-signature”,
“.spl” => “application/futuresplash”,
“.class” => “application/octet-stream”,
“.ps” => “application/postscript”,
“.torrent” => “application/x-bittorrent”,
“.dvi” => “application/x-dvi”,
“.gz” => “application/x-gzip”,
“.pac” => “application/x-ns-proxy-autoconfig”,
“.swf” => “application/x-shockwave-flash”,
“.tar.gz” => “application/x-tgz”,
“.tgz” => “application/x-tgz”,
“.tar” => “application/x-tar”,
“.zip” => “application/zip”,
“.mp3” => “audio/mpeg”,
“.m3u” => “audio/x-mpegurl”,
“.wma” => “audio/x-ms-wma”,
“.wax” => “audio/x-ms-wax”,
“.ogg” => “application/ogg”,
“.wav” => “audio/x-wav”,
“.gif” => “image/gif”,
“.jpg” => “image/jpeg”,
“.jpeg” => “image/jpeg”,
“.png” => “image/png”,
“.xbm” => “image/x-xbitmap”,
“.xpm” => “image/x-xpixmap”,
“.xwd” => “image/x-xwindowdump”,
“.css” => “text/css”,
“.html” => “text/html”,
“.htm” => “text/html”,
“.js” => “text/javascript”,
“.asc” => “text/plain”,
“.c” => “text/plain”,
“.cpp” => “text/plain”,
“.log” => “text/plain”,
“.conf” => “text/plain”,
“.text” => “text/plain”,
“.txt” => “text/plain”,
“.dtd” => “text/xml”,
“.xml” => “text/xml”,
“.mpeg” => “video/mpeg”,
“.mpg” => “video/mpeg”,
“.mov” => “video/quicktime”,
“.qt” => “video/quicktime”,
“.avi” => “video/x-msvideo”,
“.asf” => “video/x-ms-asf”,
“.asx” => “video/x-ms-asf”,
“.wmv” => “video/x-ms-wmv”,
“.bz2” => “application/x-bzip”,
“.tbz” => “application/x-bzip-compressed-tar”,
“.tar.bz2” => “application/x-bzip-compressed-tar”
)

server.username = “getcapture”
server.port = 4444
server.groupname = server.username
var.base = “/home/” + server.username
server.document-root = base + “/application/public/”
server.pid-file = base + “/var/run/lighttpd.pid”
server.tag = “Betterlabs.net On Lighty Rails”
server.indexfiles = ( “index.php”, “index.html”,
“index.htm”, “default.htm” )
url.access-deny = ( “~”, “.inc”, “.ht” )

#-- Logging
accesslog.filename = base + “/var/log/lighttpd.access.log”
server.errorlog = base + “/var/log/lighttpd.error.log”
server.error-handler-404 = “/dispatch.fcgi”

fastcgi.server = ( “.fcgi” =>
( “localhost” =>
( “socket” => base + “/var/run/application.socket”,
“min-procs” => 1,
“max-procs” => 2,
“bin-path” => base + “/application/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “production” )
)
)
)

On 4/15/06, Vince W. [email protected] wrote:


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


http://www.freeonrails.com - Free as in beer !

Ok, I’m kind of pulling at straws but try some of the following:

add mod_proxy
remove mod_cgi
remove the 2 perl cgi lines you have:
(cgi.assign = ( “.pl” => “/usr/bin/perl”,
“.cgi” => “/usr/bin/perl” ))

You are starting lighttpd as root I assume? Does the user/group
getcapture exist and have full permissions to the folder with
dispatch.fcgi? You may want to remove that line for kicks and see if it
works as root.

Tried all what you suggested. Tried running as root. Removed
user/group options. Still the same error :frowning:

[root@alpha getcapture]# lighthttpd -f etc/lighttpd/lighttpd.conf
[root@alpha getcapture]# 2006-04-15 13:01:03: (mod_fastcgi.c.1022)
execve failed for: /home/getcapture/application/public/dispatch.fcgi
No such file or directory
2006-04-15 13:01:03: (mod_fastcgi.c.1048) the fastcgi-backend
/home/getcapture/application/public/dispatch.fcgi failed to start:
2006-04-15 13:01:03: (mod_fastcgi.c.1052) child exited with status 2
/home/getcapture/application/public/dispatch.fcgi
2006-04-15 13:01:03: (mod_fastcgi.c.1055) 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
2006-04-15 13:01:03: (mod_fastcgi.c.1060) If this is PHP on Gentoo add
fastcgi to the USE flags
2006-04-15 13:01:03: (mod_fastcgi.c.1356) [ERROR]: spawning fcgi failed.
2006-04-15 13:01:03: (server.c.834) Configuration of plugins failed.
Going down.

That doesn’t work with latest lighttpd. Check
https://trac.lighttpd.net/trac/ticket/487

I’m kinda stuck at a dead end…Thanks for your time Vince.

-Pratik

On 4/15/06, Vince W. [email protected] wrote:

Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


http://www.freeonrails.com - Free as in beer !

Pratik Naik wrote:

Tried all what you suggested. Tried running as root. Removed
user/group options. Still the same error :frowning:

Weird… sorry I’m not an expert here…

How about if you modify your bin-path to just “public/dispatch.fcgi”

I think you are seeing these errors not because of php. You need to
make sure that your dispatch.fcgi is executable and that the #!
line is correct.

Cheers-
-Ezra

Pratik Naik wrote:

That doesn’t work with latest lighttpd. Check
https://trac.lighttpd.net/trac/ticket/487

Good to know… I’ll have to watch out for that…

Can you simplify your conf file by removing the var.base stuff? Try
just putting in absolute URLs and see if that works:

For instance

server.username = “getcapture”
server.port = 4444
server.groupname = server.username
server.document-root = “/home/getcapture/application/public/”
server.pid-file = “/home/getcapture/var/run/lighttpd.pid”
Server.tag = “Betterlabs.net On Lighty Rails”
server.indexfiles = ( “index.php”, “index.html”,
“index.htm”, “default.htm” )
url.access-deny = ( “~”, “.inc”, “.ht” )

#-- Logging
accesslog.filename =
“/home/getcapture/var/log/lighttpd.access.log”
server.errorlog =
“home/getcapture/var/log/lighttpd.error.log”
server.error-handler-404 = “/dispatch.fcgi”

etc.

Still no success :frowning: Anyone ?

Thanks,
Pratik

On 4/15/06, Vince W. [email protected] wrote:


Posted via http://www.ruby-forum.com/.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


http://www.freeonrails.com - Free as in beer !

Whats the very first line of your dispatch.fcgi say? And does it match
where
ruby is actually installed( where ruby )?

Or try this:

fastcgi.server = ( “.fcgi” => ( “localhost” => (
“min-procs” => 1, “max-procs” => 1, “socket” => “log/fcgi.socket”,
“bin-path” => CWD + “/public/dispatch.fcgi”, “bin-environment” => (
“RAILS_ENV” => “development” )
) ) )

Found the above on another site…

I finally got it working. I don’t really know what caused it to work
finally. But I think it was due to my invalid emacs settings. Not
really sure.

Thanks for your time,
Pratik

On 4/16/06, Nick S. [email protected] wrote:

On 4/15/06, Vince W. [email protected] wrote:

http://www.freeonrails.com - Free as in beer !
http://lists.rubyonrails.org/mailman/listinfo/rails


http://www.freeonrails.com - Free as in beer !

Pratik,

I too have been having trouble with Lighty. Is it possible for you to
post your lighty.conf or at least the portion dealing with the fastcgi?
Thanks.

  • Robert D.

Hi Robert,

This is my lighttpd.conf file :

BetterLabs.net - Lighty Configuration File

server.modules = ( “mod_rewrite”,
“mod_redirect”,
“mod_access”,
“mod_cgi”,
“mod_fastcgi”,
“mod_compress”,
“mod_accesslog” )

cgi.assign = ( “.pl” => “/usr/bin/perl”,
“.cgi” => “/usr/bin/perl” )

mimetype.assign = (
“.pdf” => “application/pdf”,
“.sig” => “application/pgp-signature”,
“.spl” => “application/futuresplash”,
“.class” => “application/octet-stream”,
“.ps” => “application/postscript”,
“.torrent” => “application/x-bittorrent”,
“.dvi” => “application/x-dvi”,
“.gz” => “application/x-gzip”,
“.pac” => “application/x-ns-proxy-autoconfig”,
“.swf” => “application/x-shockwave-flash”,
“.tar.gz” => “application/x-tgz”,
“.tgz” => “application/x-tgz”,
“.tar” => “application/x-tar”,
“.zip” => “application/zip”,
“.mp3” => “audio/mpeg”,
“.m3u” => “audio/x-mpegurl”,
“.wma” => “audio/x-ms-wma”,
“.wax” => “audio/x-ms-wax”,
“.ogg” => “application/ogg”,
“.wav” => “audio/x-wav”,
“.gif” => “image/gif”,
“.jpg” => “image/jpeg”,
“.jpeg” => “image/jpeg”,
“.png” => “image/png”,
“.xbm” => “image/x-xbitmap”,
“.xpm” => “image/x-xpixmap”,
“.xwd” => “image/x-xwindowdump”,
“.css” => “text/css”,
“.html” => “text/html”,
“.htm” => “text/html”,
“.js” => “text/javascript”,
“.asc” => “text/plain”,
“.c” => “text/plain”,
“.cpp” => “text/plain”,
“.log” => “text/plain”,
“.conf” => “text/plain”,
“.text” => “text/plain”,
“.txt” => “text/plain”,
“.dtd” => “text/xml”,
“.xml” => “text/xml”,
“.mpeg” => “video/mpeg”,
“.mpg” => “video/mpeg”,
“.mov” => “video/quicktime”,
“.qt” => “video/quicktime”,
“.avi” => “video/x-msvideo”,
“.asf” => “video/x-ms-asf”,
“.asx” => “video/x-ms-asf”,
“.wmv” => “video/x-ms-wmv”,
“.bz2” => “application/x-bzip”,
“.tbz” => “application/x-bzip-compressed-tar”,
“.tar.bz2” => “application/x-bzip-compressed-tar”
)

server.username = “indiahappening”
server.port = 3333
server.groupname = server.username
var.base = “/home/” + server.username
server.document-root = base + “/application/public/”
server.pid-file = base + “/var/run/lighttpd.pid”
server.tag = “Betterlabs.net On Lighty Rails”
server.indexfiles = ( “index.php”, “index.html”,
“index.htm”, “default.htm” )
url.access-deny = ( “~”, “.inc”, “.ht” )

#-- Logging
accesslog.filename = base + “/var/log/lighttpd.access.log”
server.errorlog = base + “/var/log/lighttpd.error.log”
server.error-handler-404 = “/dispatch.fcgi”

fastcgi.server = ( “.fcgi” =>
( “localhost” =>
( “socket” => base + “/var/run/application.socket”,
“min-procs” => 1,
“max-procs” => 2,
“bin-path” => base + “/application/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “production” )
)
)
)

Hope that helps.

Thanks,
Pratik

Thanks Pratik. I will try it on my machine and see what happens. Much
appreciated.

  • Robert D.