问题
I wrote a toy fastcgi app using the linux example. I'd like to run it on windows now. How do i do it? I know how to spawn the process on linux and connect to it via nginx (or lighttp). I have no idea how to spawn the process on widnows. I build the app using pthreads and the fastcgi lib. spawning is my next step. I googled with no luck. I'd like to connect via nginx on windows.
How do i spawn my fastcgi app on windows? (i'm on windows 7)
回答1:
I found a solution. I put a ifdef WIN32 and added this lineFCGX_OpenSocket(":1234", 10);
1234 is the port and 10 is the backlog on the listen function.
回答2:
Good example worked for me (Windows CodeBlocks GCC compiler):
#include <fcgiapp.h>
int main()
{
int sockfd = FCGX_OpenSocket("/var/run/myfcgiserver.sock", 1024);
FCGX_Request request;
FCGX_Init();
FCGX_InitRequest(&request, sockfd, 0);
while (FCGX_Accept_r(&request) == 0)
{
FCGX_FPrintF(request.out, "Content-type: text/html\r\n"
"\r\n")
"<h1>Hello World!</h1>");
FCGX_Finish_r(&request);
}
}
from: http://forum.nginx.org/read.php?2,1399,1439,quote=1
来源:https://stackoverflow.com/questions/9223007/spawn-fastcgi-apps-on-windows