spawn fastcgi apps on windows?

只谈情不闲聊 提交于 2020-01-05 08:55:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!