Just wondering if any rails experts could give me a hand with this problem.

I have rails/fcgi/lighttpd set up, when I use script/server it loads up fine. However if I try to run lighttpd as a service /etc/init.d/lighttpd start using the config file in /etc/lighttpd/lighttpd.conf it doesn't quite work.

It displays the welcome to rails message but in the "About your application's environment" box it has 404 error, I also get a 404 error when trying to view any dynamic pages.

Here is my lighttpd.conf file :

# lighttpd configuration file

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

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

server.error-handler-404 = "/var/www/bc/public/dispatch.fcgi"
server.document-root     = "/var/www/bc/public"

server.errorlog          = "/var/log/lighttpd.error.log"
accesslog.filename       = "/var/log/lighttpd.access.log"

url.rewrite              = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )

compress.filetype        = ( "text/plain", "text/html", "text/css", "text/javascript" )
compress.cache-dir       = "/var/www/bc/tmp/cache"

expire.url               = ( "/favicon.ico"  => "access 3 days", 
                             "/images/"      => "access 3 days", 
                             "/stylesheets/" => "access 3 days",
                             "/javascripts/" => "access 3 days" )

fastcgi.server      = ( ".fcgi" => ( "localhost" => (
  "min-procs"       => 1, 
  "max-procs"       => 1,
  "socket"          => "/var/www/bc/tmp/sockets/fcgi.socket",
  "bin-path"        => "/var/www/bc/public/dispatch.fcgi",
  "bin-environment" => ( "RAILS_ENV" => "development" )
) ) )

mimetype.assign = (  
  ".css"        =>  "text/css",
  ".gif"        =>  "image/gif",
  ".htm"        =>  "text/html",
  ".html"       =>  "text/html",
  ".jpeg"       =>  "image/jpeg",
  ".jpg"        =>  "image/jpeg",
  ".js"         =>  "text/javascript",
  ".png"        =>  "image/png",
  ".swf"        =>  "application/x-shockwave-flash",
  ".txt"        =>  "text/plain"
)

$HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
  server.max-keep-alive-requests = 0
}

Any ideas what could be causing my problems? Or any ideas where to look?

I actually solved this the day after I posted but forgot to update it,

just needed to change

server.error-handler-404 = "/var/www/bc/public/dispatch.fcgi"

to

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

Thanks for posting this - found it by Google and saved me a lot of headache. =)

Jason

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.