Nickl
Nickl

Reputation: 1473

Running C++ as FastCGI in Lighttpd

I'm trying to run C++ binaries as FastCGI in Lighttpd, but it won't start. I tried something like this:

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

But I can't get it working. I want to keep the C++ in memory for starting really fast.

Upvotes: 1

Views: 1821

Answers (1)

Maxim
Maxim

Reputation: 1666

You should adapt your configuration to something like this:

  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,
      )
    )
  )

For all requests: localhost/api/some_test lighttp will call your fcgi executable /var/www/localhost/cgi-bin/test.fcgi

Upvotes: 2

Related Questions