Config file for Lighttpd for win 2003 server


#1

Hi All

I am having difficulties setting up the lighttpd.conf file for running
Ruby
on Rails on my windows 2003 server. I have actually managed to get it up
and running by trial and error, but it is very slow.

Not fully understanding the lighttpd.conf file I suspect that maybe it
is
not running fastcgi, but only cgi since I have heard that this would be
slow.
Maybe it it is not necessary to include the mod_cgi at all ?

My lighttpd.con file i pasted below. Any ideas are most welcome.

lighttpd.conf

lighttpd configuration file

use a it as base for lighttpd 1.0.0 and above

$Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $

############ Options you really have to take care of
####################

modules to load

at least mod_access and mod_accesslog should be loaded

all other module should only be loaded if really neccesary

- saves some time

- saves memory

server.modules = (
“mod_rewrite”,
“mod_redirect”,

“mod_alias”,

                            "mod_access",

“mod_cml”,

“mod_trigger_b4_dl”,

“mod_auth”,

“mod_status”,

“mod_setenv”,

                            "mod_fastcgi",

“mod_proxy”,

“mod_simple_vhost”,

“mod_evhost”,

“mod_userdir”,

                            "mod_cgi",

“mod_compress”,

“mod_ssi”,

“mod_usertrack”,

“mod_expire”,

“mod_secdownload”,

“mod_rrdtool”,

                            "mod_accesslog" )

server.document-root = “E:/apache2triad/htdocs/appname/public”

where to send error-messages to

server.errorlog = “C:/lighttpd/logs/lighttpd.error.log”

files to check for if …/ is requested

server.indexfiles = ( “index.php”, “index.html”, “dispatch.fcgi” )
server.error-handler-404 = “/dispatch.fcgi”

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” => “application/ogg”,
“.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”,
“.cpp” => “text/plain”,
“.log” => “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”
)

accesslog module

accesslog.filename = “C:/lighttpd/logs/access.log”

deny access the file-extensions

~ is for backupfiles from vi, emacs, joe, …

.inc is often used for code includes which should in general not be

part

of the document-root

url.access-deny = ( “~”, “.inc” )

$HTTP[“url”] =~ “.pdf$” {
server.range-requests = “disable”
}

######### Options that are good to be but not neccesary to be changed
#######

bind to port (default: 80)

server.port = 81

bind to localhost (default: all interfaces)

#server.bind = “grisu.home.kneschke.de

error-handler for status 404

#server.error-handler-404 = “/error-handler.html”
#server.error-handler-404 = “/error-handler.php”

to help the rc.scripts

#server.pid-file = “/var/run/lighttpd.pid”

enable debugging

#debug.log-request-header = “enable”
#debug.log-response-header = “enable”
#debug.log-request-handling = “enable”
#debug.log-file-not-found = “enable”

You need to let Ruby handle .rb, .cgi and .fcgi files

cgi.assign = ( “.rb” => “E:/ruby/bin/rubyw.exe”,
“.fcgi” => “E:/ruby/bin/rubyw.exe”,
“.cgi” => “E:/ruby/bin/rubyw.exe”)

5 .fcgi spawns seem to work fine for a reasonable load

fastcgi.server = (
“.fcgi” =>
( “appname” =>
( “min-procs” => 1,
“max-procs” => 2,
“socket” =>
“E:/apache2triad/htdocs/appname/public/tmp/ruby-railsapp.fastcgi”,
“bin-path” =>
“E:/apache2triad/htdocs/appname/public/dispatch.fcgi”,
“bin-environment” => (“RAILS_ENV” => “development”)
)
)
)