It's necessary to configure which parameters are passed to fast-cgi application from nginx server. For this purposes serves fastcgi_param keyword. It's a good practice to keeps all fastcgi params together. For this purposes nginx has fastcgi.conf file. This file already contains most of useful fastcgi_param bindings.
To include this file use include statement:
Default configuration pass only default headers to fast-cgi. It's necessary to add few more configurations statements:
After that headers are passed as HTTP_* parameters:
Step by step guide how to configure nginx on windows....
Download nginx package from nginx site. Unpack it and installation is done ;-)
No create and complie fast-cgi application. (How to compile fast-cgi on windows)
There are two ways. When web-server supports fast-cgi you will be able to connect fast-cgi directly with web-server via configuration files. In all other cases fast-cgi offers cgi-fcgi executable as bridge between webserver and your app. More info about both these approaches you can find here http://www.fastcgi.com/devkit/doc/fcgi-devel-kit.htm#S4.
None of two ways described in previous article and in official documentation works for me on windows. I wasn't able to get cgi-fcgi or spawn-fcgi running. First mentioned crashed everytime app tries to initialize STD_OUT, the second one isn't possible to compile it because of missing unistd.h header.
Fortunately there is one more way. FCGI library offers one more way how to utilize FCGI mechanism. It's necessary add two more lines to example above and everything works perfectly.
After this change application initialize listening port and waits for incoming data. All you need to do is directly execute the app.
This step compared to previous ones is pretty easy. You need to tell nginx server what and where to pass. Open file nginx.conf and add following statement:
fastcgi_pass statement forward all requests to localhost:9345 address. Now when you start your nginx server, everything should work as expected.
This error is caused by another application which uses port 80. In my case it was Skype which automatically uses port 80.
FastCGI comes with Win32 project for VisualStudio6. Unfortunately when you try to open it in VisualStudio2010 the project will be corrupted. To correctly compile it for VS2010 it's necessary to download library sources, get patches from cybozu.co.jp site and apply it.
Download latest version of Development Kit here and extract it to standalone directory.
Download all five patches from Cybozu site. Now when you have patches it's necessary to convert all files to correct windows-ending format. This can be done for example in Notepad++.
Now you need some application capable to apply the patches. Unfortunately windows doesn't contain any application for this task and also lot of comparing/merging applications can't do that.
Open directory with fastcgi library, copy all patch files to this directory and open command line. As next run patch command for all fives patches:
In case you will see following error message:
it's necessary to convert ALL patch files to correct Windows format (correct EOL) as mentioned in previous section.
When you apply patches by cybozu it's time to apply my own patches ;-).
As first, it's probably that you will see following message:
It's because original patch is for older version of library and file os_win32.c is slightly different. To fix that, edit this file at line 841 and manually update following line:
Now turn off generating the Map Files in project configuration. These files aren't necessary and it isn't possible to compile project correctly with this settings.
And that's all. Now you will be able to sucesfully compile fast-cgi library.
**Visual Studio C++ fcgi Echo Example** - http://www.coastrd.com/cppecho
CGICC - how to update it for VS2010 COMPILATION