First try with lighttpd


#1

Hi,

I have a Rails application sitting on my computer that works just fine
with webrick. I would like to try to serve it locally with lighttpd

I followed the instructions on the hivelogic site for installing
lighttpd

http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger

Then I looked on page 457 in the Agile Rails book for instructions
about configuring the rails app for lighttpd and wrote the config file
at the bottom of this email.

I started the Rails app with “lighttpd -f config/lighttpd.conf”.

When I tried to view the site in a browser I saw an unexpected error

#28000Access denied for user ‘root’@‘localhost’ (using password: NO)

In my database.yml file i am not using root for the mysql user for
either development or production. Does lighttpd not know to look in
database.yml?

Thanks,
Peter

server.port = 80
server.bind = “127.0.0.1”
server.event-handler = “freebsd-kqueue”
server.modules = ( “mod_rewrite”, “mod_fastcgi” )
url.rewrite = ( “^/$” => “index.html”, “^([^.]+)$” => “$1.html” )
server.error-handler-404 = “/dispatch.fcgi”
server.document-root = “/Users/peter/characters/public”
server.errorlog = “/Users/peter/characters/log/server.log”
fastcgi.server = ( “.fcgi” =>
( “localhost” =>
(
“min-procs” => 10,
“max-procs” => 10,
“socket” => “/tmp/characters.fcgi.socket”,
“bin-path” => “/Users/peter/characters/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “production” )
)
)
)


#2

Hi,

I’ve been trying to get just an empty Rails site to work with the
lighttpd config file below. I can’t even see the Welcome you’re riding
the rails page.

Any ideas what to do?

Thanks,
Peter

On 5/20/06, Peter M. removed_email_address@domain.invalid wrote:

about configuring the rails app for lighttpd and wrote the config file
database.yml?

Thanks,
Peter

server.port = 3000
server.bind = “127.0.0.1”
server.event-handler = “freebsd-kqueue”
server.modules = ( “mod_rewrite”, “mod_fastcgi” )
url.rewrite = ( “^/$” => “index.html”, “^([^.]+)$” => “$1.html” )
server.error-handler-404 = “/dispatch.fcgi”
server.document-root = “/Users/peter/characters/public”
server.errorlog = “/Users/peter/characters/log/server.log”
fastcgi.server = ( “.fcgi” =>
( “localhost” =>
(
“min-procs” => 10,
“max-procs” => 10,
“socket” => “/tmp/characters.fcgi.socket”,
“bin-path” => “/Users/peter/characters/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “production” )
)
)
)


#3

Hello,

Try deleting your lighttpd.conf.

Then run “script/server” on your app WITHOUT anything else. Rails will
use lighttpd by default and import a lighttpd.conf

Hope this works.

Ben


#4

On 5/21/06, Ben removed_email_address@domain.invalid wrote:

Try deleting your lighttpd.conf.

Then run “script/server” on your app WITHOUT anything else. Rails will
use lighttpd by default and import a lighttpd.conf

Hi Ben,

Thanks for the advice. It did create an lighttpd.conf and I am able to
view the “Welcome aboard!” Rails page.

However when I generate a controller and basic view

$ script/generate controller front index

restart the server, and navigate to

http://localhost:3000/front

the server crashes. I look in log/fascgi.crash and find

[21/May/2006:12:03:40 :: 781] starting
[21/May/2006:12:04:06 :: 792] starting
[21/May/2006:12:04:40 :: 792] Dispatcher failed to catch: (Interrupt)
/usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:in each' /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb:597:ineach_cgi’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:53:in
process!' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/fcgi_handler.rb:23:inprocess!’
/Users/peter/temp/public/dispatch.fcgi:24
killed by this error

This all does work if I use webrick server.

Any ideas?

Thanks,
Peter