在Lighttpd中运行c++作为FastCGI

Running C++ as FastCGI in Lighttpd

本文关键字:作为 FastCGI c++ 运行 Lighttpd      更新时间:2023-10-16

我试图在Lighttpd中运行c++二进制文件作为FastCGI,但它不会启动。我尝试这样做:

fastcgi.server += (".cpp" =>
        ( "localhost" =>
            (
                "socket" => "/tmp/mysocket",
                "bin-path" => "/var/www/index.cpp",
                "max-procs" => 1
        ))
)

但是我不能使它工作。我想把c++保存在内存中以便快速启动

您应该这样调整您的配置:

  fastcgi.server = (
    "/api" => (
      "api.fastcgi.handler" => (
        "socket" => "/var/run/lighttpd/lighttpd-fastcgi-test-" + PID + ".socket",,
        "check-local" => "disable",
        "bin-path" => "/var/www/localhost/cgi-bin/test.fcgi",
        "max-procs" => 30,
      )
    )
  )

对于所有请求:localhost/api/some_test lighttp将调用fcgi可执行文件/var/www/localhost/cgi-bin/test.fcgi