Ubuntu 6.06, Lighttpd and Ruby on Rails

UPDATE: .conf file does let me start server but I now get 404 error in browser.

–-----------------------------------------------------------------------------------

Hi, I've recently rented my linode to learn more about deploying Ruby on Rails web applications. I'm having problems getting my application running on my linode. Does anyone know of a tutorial, post etc. somewhere that will set me on the right track? I've followed various sets of instructions but have had no success so far, although I have figured out that the set up of the lighttpd.conf file seems to be the source of my problems at the moment.

Here is my lighttpd.conf file:

++++++++++ START ++++++++++++++

server.modules = (

"mod_rewrite",

"mod_redirect",

"mod_alias",

"mod_access",

"mod_fastcgi",

"modsimplevhost",

"mod_accesslog"

)

mimetype mapping

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

".wav" => "audio/x-wav",

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

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

)

Use the "Content-Type" extended attribute to obtain mime type if possible

mimetype.use-xattr = "enable"

server.username = "lighttpd"

server.groupname = "lighttpd"

server.document-root = APP_ROOT + "/public/"

server.pid-file = "/var/run/lighttpd.pid"

server.port = 80

accesslog.filename = "/var/log/lighttpd/access_log"

server.errorlog = "/var/log/lighttpd/error_log"

url.access-deny = ( "~", ".inc" )

fastcgi mapping

fastcgi.server = ( ".fcgi" => ( "localhost" => (

"min-procs" => 2,

"max-procs" => 2,

"socket" => "/tmp/sockets/fcgi.socket",

"max-procs" => 2,

"socket" => "/tmp/sockets/fcgi.socket",

"bin-path" => APP_ROOT + "/public/dispatch.fcgi",

"bin-environment" => ( "RAILS_ENV" => "production" )

) ) )

server.indexfiles = ( "index.php", "index.html",

"index.htm", "default.htm", "dispatch.fcgi" )

+++++++++++++++ END ++++++++++++++++++++

With this config file Lighttpd won't start. The fastcgi.server bit is the thing that I changed. Before that Lighttpd was at least running. Any help would be greatly appreciated.

2 Replies

Chris, is it working using regular CGI?

Hi Jason,

I haven't got around to using plain old CGI yet (not sure exactly how to set that up), but I have made some progress. I can access my test app (shopping cart from the 'Agile Web Development with Rails' book) if I run it via the 'ruby script/server' command in the application root directory and everything works.

When I attempt to access the app through a browser remotely with the URL of my linode (xxx.members.linode.com), I get the first store page as expected, but none of the other links or functionality seem to work.

So for instance, if I put a URL in like 'xxxx.members.linode.com/admin', I get a 404 error instead of the admin login screen. I had a look at the routes.rb file but I haven't been able to rectify things.

routes.rb looks like this :-

+++++++++++++++++ START ++++++++++++++++++++

ActionController::Routing::Routes.draw do |map|

The priority is based upon order of creation: first created -> highest priority.

Sample of regular route:

map.connect 'products/:id', :controller => 'catalog', :action => 'view'

Keep in mind you can assign values other than :controller and :action

Sample of named route:

map.purchase 'products/:id/purchase', :controller => 'catalog', :action => 'purchase'

This route can be invoked with purchase_url(:id => product.id)

You can have the root of your site routed by hooking up ''

– just remember to delete public/index.html.

map.connect '', :controller => 'store'

map.connect 'admin/', :controller => 'login'

Allow downloading Web Service WSDL as a file with an extension

instead of a file named 'wsdl'

map.connect ':controller/service.wsdl', :action => 'wsdl'

Install the default route as the lowest priority.

map.connect ':controller/:action/:id'

++++++++++++++++ END ++++++++++++++++++++

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct