Hi everybody
I am trying to get RoR to work with lighttpd.
Nearly there, but I am stuck with a strange phenomenon.
If I configure lighttpd to serve pages on say port 2000, I can get at my
testapp fine and see the “Welcome aboard” page.
However, if I configure lighttpd to use port 80, I get a download prompt
from my browser.
If I access my URI like “http://ruby.cajones.org”, I get:
‘You have chosen to open which is a: application/octet-stream from
http://ruby.cajones.org What should Firefix do with this file?’
If I access the URI as “http://ruby.cajones.org/index.html”, I get:
‘You have chosen to open index.html which is a HTML file from
http://ruby.cajones.org What should Firefox do with this file?’
If I then open it the content is the “Welcome aboard” page.
Looks like the MIME type gets screwed up if port = 80.
As a seasond admin, I spent a day trying to fix this but couldn’t find
the problem
(There was a appearent bug in Debian/lighttpd, some perl script to wrap
the MIME types in /etc/mime.types was not executable.
To make sure I wasn’t affected by this bug I have hardcoded all the MIME
entries in the conf file. Still, it does not make any difference. And
still everything works fine if port != 80).
My lighttpd.conf in total:
server.modules = (
“mod_rewrite”,
“mod_redirect”,
“mod_access”,
“mod_fastcgi”,
“mod_compress”,
“mod_accesslog”,
)
server.document-root = “/www/TestApp/public”
server.errorlog = “/var/log/lighttpd/error.log”
server.indexfiles = ( “index.html”,
“index.htm”,
“index.php”,
“default.htm”
)
mimetype.assign = ( “.png” => “image/png”,
“.jpg” => “image/jpeg”,
“.jpeg” => “image/jpeg”,
“.html” => “text/html”,
“.txt” => “text/plain”
)
accesslog.filename = “/var/log/lighttpd/access.log”
url.access-deny = ( “~”, “.inc” )
server.port = 80
server.error-handler-404 = “/dispatch.fcgi”
server.pid-file = “/var/run/lighttpd.pid”
server.dir-listing = “enable”
server.username = “www-data”
server.groupname = “www-data”
fastcgi.server = ( “.fcgi” =>
( “localhost” =>
(
“min-procs” => 1,
“max-procs” => 5,
“socket” => “/tmp/ruby-railsapp.fastcgi”,
“bin-path” => “/www/TestApp/public/dispatch.fcgi”
)
)
)
fastcgi.debug = 1
Using this very config file and only changing the port number yields a
valid page. Using port 80 screws up the MIME type.
Any hints would be very much appreciated.
FYI. Server = Debian Sarge
Ruby = 1.8.4
Rails = 1.0.0
Lighttpd = 1.4.8
Postgres = 8.1.2
This box runs no other stuff.
–
Dick Visser
TERENA IT-support officer / webmaster
Singel 468D, 1017 AW, Amsterdam, The Netherlands
Phone: +31 20 5304488 Fax: +31 20 5304499
Email: [email protected] http://www.terena.nl
Live IPv4/6 webcam: http://www.terena.nl/~dick
PGP-key: http://www.terena.nl/~dick/pgp.key.asc