Forum: Ruby on Rails Trouble with Lighty

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-04-15 20:33
(Received via mailing list)
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...
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 !
26ca684555abbdb44f01bd1e165e649b?d=identicon&s=25 Vince W. (vince)
on 2006-04-15 20:59
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...
> 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/set...

There's a sample lighttpd.conf file too.
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-04-15 21:04
(Received via mailing list)
Nop. I'm not trying to use php. It's pure rails.

On 4/15/06, Vince W. <vince71@gmail.com> wrote:
> > 2006-04-15 11:27:24: (mod_fastcgi.c.1356) [ERROR]: spawning fcgi failed.
> 
http://www.urbanpuddle.com/articles/2006/03/17/set...
>
> There's a sample lighttpd.conf file too.
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
http://www.freeonrails.com - Free as in beer !
26ca684555abbdb44f01bd1e165e649b?d=identicon&s=25 Vince W. (vince)
on 2006-04-15 21:11
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
     )
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-04-15 21:22
(Received via mailing list)
No success :( 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. <vince71@gmail.com> 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 !
26ca684555abbdb44f01bd1e165e649b?d=identicon&s=25 Vince W. (vince)
on 2006-04-15 21:34
Pratik Naik wrote:
> No success :( 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?
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-04-15 21:41
(Received via mailing list)
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. <vince71@gmail.com> wrote:
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
http://www.freeonrails.com - Free as in beer !
26ca684555abbdb44f01bd1e165e649b?d=identicon&s=25 Vince W. (vince)
on 2006-04-15 21:55
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.
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-04-15 22:05
(Received via mailing list)
Tried all what you suggested. Tried running as root. Removed
user/group options. Still the same error :(

[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...
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.
26ca684555abbdb44f01bd1e165e649b?d=identicon&s=25 Vince W. (vince)
on 2006-04-15 22:20
Pratik Naik wrote:
> Tried all what you suggested. Tried running as root. Removed
> user/group options. Still the same error :(


Weird.. sorry I'm not an expert here..

How about if you modify your bin-path to just "public/dispatch.fcgi"
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-04-15 22:30
(Received via mailing list)
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. <vince71@gmail.com> wrote:
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
http://www.freeonrails.com - Free as in beer !
26ca684555abbdb44f01bd1e165e649b?d=identicon&s=25 Vince W. (vince)
on 2006-04-15 22:42
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.
6076c22b65b36f5d75c30bdcfb2fda85?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-04-15 22:45
(Received via mailing list)
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
26ca684555abbdb44f01bd1e165e649b?d=identicon&s=25 Vince W. (vince)
on 2006-04-15 22:46
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..
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-04-16 11:42
(Received via mailing list)
Still no success :( Anyone ?

Thanks,
Pratik

On 4/15/06, Vince W. <vince71@gmail.com> wrote:
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
http://www.freeonrails.com - Free as in beer !
Cb610750ee94ca103aef4b2dc7b1b768?d=identicon&s=25 Nick Stuart (Guest)
on 2006-04-16 17:49
(Received via mailing list)
Whats the very first line of your dispatch.fcgi say? And does it match
where
ruby is actually installed( `where ruby` )?
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-04-17 08:00
(Received via mailing list)
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 Stuart <nicholas.stuart@gmail.com> wrote:
> > On 4/15/06, Vince W. <vince71@gmail.com> wrote:
> > >
> > http://www.freeonrails.com - Free as in beer !
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>


--
http://www.freeonrails.com - Free as in beer !
Cf17040cecb2618506f5ca4c14957957?d=identicon&s=25 Robert Dempsey (flatekmonkey)
on 2006-04-17 13:11
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 Dempsey
A05834e9b5954947eb0ba3b570c47d5e?d=identicon&s=25 Pratik Naik (pratik)
on 2006-04-17 14:33
(Received via mailing list)
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
Cf17040cecb2618506f5ca4c14957957?d=identicon&s=25 Robert Dempsey (flatekmonkey)
on 2006-04-17 14:55
(Received via mailing list)
Thanks Pratik. I will try it on my machine and see what happens. Much
appreciated.

- Robert Dempsey
This topic is locked and can not be replied to.