在Lighttpd中将C ++作为FastCGI运行

时间:2014-06-23 11:13:54

标签: c++ fastcgi lighttpd

我试图在Lighttpd中将C ++二进制文件作为FastCGI运行,但它不会启动。我试过这样的事情:

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

但我无法让它发挥作用。我希望将C ++保留在内存中以便快速启动。

1 个答案:

答案 0 :(得分:1)

您应该将配置调整为:

  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