kristapsdz / kcgi

minimal CGI and FastCGI library for C/C++
https://kristaps.bsd.lv/kcgi
ISC License
275 stars 40 forks source link

Documentation for web servers #77

Open markand opened 4 years ago

markand commented 4 years ago

Hello,

This isn't a direct issue to kcgi but I think it could be valuable to add some information on how to use FastCGI with kcgi based programs on the official documentation.

kcgi makes uses of PATH_INFO which seems... to be poorly implemented in most web servers.

Lighttpd

For the moment, I was unable to get fastcgi working with my kcgi program. I've tried the following but the program never had PATH_INFO correctly set:

$HTTP["host"] == "myhostname.tld" {
       fastcgi.server = (
               "/" => ((
                       "socket" => "/path/to/socket",
                       "broken-scriptfilename" => "enable",
                       "fix-root-scriptname" => "enable"
               ))
       )

Nginx

With nginx it works a bit better but there are not many documentation regarding the PATH_INFO handling.

I needed to add manually fastcgi_param PATH_INFO $uri but not even sure if this is appropriate.

location / {
    include /etc/nginx/fastcgi_params;
    fastcgi_param PATH_INFO $uri;
    fastcgi_pass unix:/home/markand/dev/paster2/paster.sock;
}

What do you think about adding a specific deployment page with those webservers?

kristapsdz commented 4 years ago

That would be perfect for a tutorial! All it takes is copying a tutorial file and adding it to the Makefile. make www and it will generate and appear in the local index.html.