More on FastCGI for IIS
I actually bothered to read the Readme for FastCGI today (it is included in the source package, not in the binaries). I've not taken a proper look at this so I don't know what effect it may have.
Some of the Path Info rewriting may be down to IIS impersonation:
For authentication to work properly in all instances, you MUST check the 'Check that file exists' checkbox, this has the unfortunate side effect of breaking path_info values.
Likewise, under your .fcgi key there are some more options to supply:
StartServers REG_DWORD 5
IncrementServers REG_DWORD 2
MaxServers REG_DWORD 25
Environment REG_BINARY
(newline deliminated, null terminated, for adding additional
environment variables ie. PHP_FCGI_MAX_REQUESTS=25)
Filter REG_DWORD 0
If set to 1, this fastcgi server will be treated as a FastCGI FILTER.
A Filter server receives the file to be filtered from the web server.
for more information, see documentation at fastcgi.com
Timeout REG_DWORD 600
How long extra servers (number above StartServers) are kept alive
before being terminated
It's the first three that are the important ones. This allows FastCGI to start multiple RubyW processes to handle each incoming request (as each process handles a single request at a time). The Environment option is to allow arguments to be passed to the ruby processor but I'm passing them through the Args key. Which of course doesn't work for the -e production option.
So get rid of your -e production and instead, create the Environment key (as a REG_BINARY) and put RAILS_ENV=PRODUCTION. A quick tip, using the XP version of RegEdit - editing a binary key gives you a text area with three columns - the decimal, hex and text. You cannot type in the decimal, but you can put in your hex values into the hex column. What is blatantly not obvious is that you can also type in the text section. So I wasted five minutes of my life looking up those values when I didn't need to.
However, I've set the Environment key to "RAILS_ENV=production" (52 41 49 4C 53 5F 45 4E 56 3D 70 72 6F 64 75 63 74 69 6F 6E 0D 0A 00) and it makes no difference - still running in Development mode. I could just edit environment.rb I suppose.
Incidentally, the Bind-Path is the named pipe that FastCGI uses to communicate, as I suspected.
If you want more than one rails application on a single server then you add new keys (instead of .fcgi, use .myapp or something like that). You need to rename your dispatch.fcgi to match the newly chosen key, create the FastCGI mapping in IIS and set up the application and args for your new file extension.
*STOP PRESS* I take it all back. The Environment key is working fine and I was being a tit.
2 comments:
The link to fastcgi is unavailable... is there an alternate location to get it from?
Not working: http://www.caraveo.com/fastcgi/
Bit busy at the moment but I'll try and dig a copy out and host it somewhere
Post a Comment