How to setup Lighttpd on Windows?

In case you're still interested:

I assume you have already, but if not 1) install ruby: Download Ruby 2) install rails: gem install rails --include-dependencies

now

3) download this and install it http://www.zedshaw.com/downloads/scgi_rails/scgi_rails-0.4.3.gem

gem install scgi_rails-0.4.3.gem

say yes if it asks if you want to install dependencies

4) install lighttpd

5) copy c:\lighttpd\etc\lighttpd.conf to your rails app's config folder. edit the config file as shown below. Replace c:/railapps with path to your rail application, e.g., c:/rorapps/myapp. I'm only showing the parts you need to change.

server.modules = (                                "mod_rewrite",                                "mod_redirect",                                "mod_access",                                "mod_accesslog",                                "mod_status",                                "mod_scgi") server.document-root = "C:/RailsApp/public" static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".scgi" ) server.error-handler-404 = "/dispatch.scgi" scgi.server = ( "dispatch.scgi" => ((   "host" => "127.0.0.1",   "port" => 9999,   "check-local" => "disable" )) ) scgi.debug=0 status.status-url = "/server-status" status.config-url = "/server-config" server.port = 3000 # or whatever you like

what this part

server.error-handler-404 = "/dispatch.scgi" scgi.server = ( "dispatch.scgi" => ((   "host" => "127.0.0.1",   "port" => 9999,   "check-local" => "disable" )) )

does is tell the lighttpd server to handle 404 file not found error by handing it off to the scgi service which will serve your rail app.

6) now, from your rail app root folder, run lighttpd

c:\lighttpd\sbin\lighttpd.exe -f config/lighttpd.conf

7) one more thing: you need to run the scgi service

scgi_service

now you should be abe to access your app

http://localhost:3000/myapp

Vapor .. wrote:

sorry I skipped a step

5.5) execute this from commandline in your rail app's folder

scgi_ctrl config -S

this creates the necessary scgi.yaml file in your config folder.

You can then create a batch file like this

@echo off echo Stopping lighty... c:\lighttpd\sbin\process.exe -k lighttpd.exe echo Starting lighty... c:\lighttpd\sbin\lighttpd.exe -f config\lighttpd.conf echo Stopping SCGI_service... c:\lighttpd\sbin\process.exe -k ruby.exe echo Starting SCGI_service... scgi_service

in your rail app's folder and execute it to get the whole thing going.