# ruby + rails + lighttpd

## robind

I'm having problems, to say the least. Everything works just dandy with webrick, but when I try to use lighty instead...well, lighty still works but rails doesn't.

my lighttpd.conf:

```

server.port                = 80

#server.bind                = ""

server.pid-file             = "/tmp/lighttpd.pid"

#server.event-handler = "freebsd-kqueue"

server.modules = ( "mod_rewrite", "mod_redirect", "mod_access", "mod_fastcgi", "mod_accesslog" )

server.document-root        = "/site/Books/public/"

server.indexfiles           = ( "dispatch.fcgi", "index.html")

accesslog.filename          = "/var/log/lighttpd_access.log"

server.errorlog             = "/var/log/lighttpd_error.log"

server.error-handler-404 = "/dispatch.fcgi"

server.dir-listing = "enable"

#### fastcgi module

## read fastcgi.txt for more info

fastcgi.server =  (

  ".fcgi" => (

    "localhost" => (

      "socket" => "/tmp/1.socket",

      "bin-path" => "/site/Books/public/dispatch.fcgi",

    )

  ),

 ("localhost" => (

        "socket" => "/tmp/2.socket",

        "bin-path" => "/site/Books/public/dispatch.fcgi",

    )

  )

)

# mimetype mapping

mimetype.assign             = (

  ".rpm"          =>      "application/x-rpm",

  ".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"          =>      "audio/x-wav",

  ".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",

  ".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"

 )

```

I'm thinking the most likely problem is I'm not dealing with .fcgi properly...but I don't really know. ANYWAYS, here's the error I get (this is uplon loading http://192.168.1.91/):

```

Routing Error

Recognition failed for "/"

```

And my lighty log file:

```

2005-09-10 23:23:56: (log.c.73) server started

2005-09-10 23:24:03: (connections.c.1256) error-handler not found: /dispatch.fcgi

2005-09-10 23:24:03: (connections.c.1256) error-handler not found: /dispatch.fcgi

2005-09-10 23:24:10: (connections.c.1256) error-handler not found: /dispatch.fcgi

2005-09-10 23:24:10: (connections.c.1256) error-handler not found: /dispatch.fcgi

2005-09-10 23:24:13: (connections.c.1256) error-handler not found: /dispatch.fcgi

2005-09-10 23:24:13: (connections.c.1256) error-handler not found: /dispatch.fcgi

2005-09-10 23:24:39: (log.c.133) server stopped

```

Anyways, it's pretty evident what's happening here...I just don't understand why  :Sad: 

And yes, dispatch.fcgi is in the directory...

```

blue Books # ls /site/Books/public/

404.html  500.html  dispatch.cgi  dispatch.fcgi  dispatch.rb  favicon.ico  images  index.html  javascripts  stylesheets

```

----------

## nazgum

that error you see is actually from not setting a default route.

try accessing the full url of what you want like:

192.168.0.100/journal/list

and then edit config/routes.rb in your app dir and modify the bottom line, adding to the end of it:

:controller => 'journal', :action => 'list' or so

[ depending on your app ]

Mine looks like this:

# Install the default route as the lowest priority.

  map.connect ':controller/:action/:id', :controller => 'home', :action => 'index'

----------

## Braempje

 *robind wrote:*   

> I'm having problems, to say the least. Everything works just dandy with webrick, but when I try to use lighty instead...well, lighty still works but rails doesn't.
> 
> my lighttpd.conf:
> 
> ```
> ...

 

Try to put an absolute path to dispatch.fcgi here!

----------

