KFCGI(8)
๐ KFCGI(8) โ the FastCGI server for kcgi apps, bestie
okay so this is the manual for kfcgi, from the System Manager's Manual section. yes we're reading a system manager page and yes it's actually kinda iconic. buckle up ๐
โจ NAME โจ
kfcgi โ FastCGI server for kcgi applications. that's it, that's the whole name section. short, sweet, ate. ๐
๐ธ SYNOPSIS ๐ธ
kfcgi [-drv] [-l backlog] [-n workers] [-N maxworkers] [-p chroot]
[-s sockpath] [-u sockuser] [-U procuser] [-w waittime] prog
[arg0...]
look at all those flags. she's got range. ๐
๐ฆ DESCRIPTION ๐ฆ
so the kfcgi server spin up worker processes of prog to handle FastCGI connections. and here's the slay part โ it can handle any FastCGI worker that implements the FastCGI v1.0 Specification, and the ones implementing the FastCGI Extensions for Management Control (that's the -r, -N, and -w ones, iykyk).
now the defaults, because defaults are literally the whole vibe check here: by default it opens the socket /var/www/run/httpd.sock in mode 0660 under the current user and group, changes to a file-system jail in /var/www, daemonises and opens its system log, then starts 3 workers executing prog โ and ngl prog must exist relative to the file-system jail root, no cap. the back-log is twice the worker pool size (-n) or, in the event of variable-sized pools, twice the maximum worker size (-N). math! she did the math! ๐งฎโจ
the arguments are as follows, and yes i'm listing every single one, because we don't skip. periodt.
๐ OPTIONS ๐
-dโ do not daemonise, and on top of syslog, print messages to standard error. very "i want to see what's happening" of you. ๐-vโ be more verbose in output. and bestie, this can produce a lot of output. like. a lot a lot. ๐ฅ-lbacklog โ the connection backlog. if this is too small, connections get refused and the request errors out ๐ญ. the operating system will usually truncate this, so don't come for the OS when it does.-nworkers โ the initial number of workers >1. gotta be more than one, that's the rule. ๐ซถ-Nmaxworkers โ the maximum number of workers in a variable-sized pool. by default this is twice-n. ๐-pchroot โ location of the file-system jail. this one's mandatory ๐: use the root directory if you insist on being insecure. (dramatic? yes. accurate? also yes.)-rโ use a variable-sized pool of workers. โ ๏ธ this can only be used for workers implementing the FastCGI Extensions for Management Control. the pool will be at least (and initially) size-n, maximum size-N, with a release policy dictated by-w. it's giving elastic. it's giving scalable. it's giving main character energy. โจ-ssockpath โ alternative socket path. pick your own adventure. ๐ฆ-usockuser โ the user in whose name (user and group) the socket is created. ๐ธ-Uprocuser โ the user in whose name the process is dropped. yes, dropped. like a hot new single. ๐-wwaittime โ the amount of time in seconds a worker must be idle before being released from a variable-sized pool. by default this is five minutes. patience is a virtue fr fr. โณ
๐ซถ stopping and restarting (very important, don't skip!!)
to properly stop a kfcgi server, send it a SIGTERM. ๐
and if you send a SIGHUP to the process, it will restart all workers. ๐ lowkey the glow-up button.
โญ EXIT STATUS โญ
the kfcgi utility exits 0 on success, and >0 if an error occurs. classic. iconic. consistent. ๐
๐ EXAMPLES ๐
on OpenBSD, the default user for the web server is โwwwโ. assuming we have a server that doesn't need any files, we can run the following to keep it in a safe jail:
# kfcgi -u www -U www -- /fcgi-bin/prog
this will execute /fcgi-bin/prog within the default file-system jail of /var/www as user โwwwโ. it will create the default socket /var/www/run/httpd.sock in mode 0660 as user โwwwโ. safe, cozy, jailed, slay. ๐ โจ
this can also be extended to run a variable-sized pool of workers that responds to system load:
# kfcgi -r -n 2 -N 100 -w 10 -u www -U www -- /fcgi-bin/prog
this will start with only two servers, but scale it to 100 in the event of a burst of communication. workers started to handle the burst will be terminated after 10 seconds. she scales! she shrinks! she does both! ๐ฆ๐ฅ
๐ SEE ALSO ๐
kcgi(3)โ go read it bestie, it's the whole reason we're here.
๐ STANDARDS ๐
kfcgi implements the โFastCGI Specificationโ, version 1.0, published 29 April 1996, for properly passing connections to the workers. it also implements the FastCGI Extensions for Management Control, right here: https://kristaps.bsd.lv/kcgi/extending01.html โ that's the one for variable-sized worker pools. standards compliant AND cute. we love to see it. ๐
ok i'm done, go forth and serve some FastCGI, you absolute legend ๐ซถ
this page came from Debian, dated $Mdocdate$, and it's KFCGI(8) โ mwah, bye bestie! ๐โจ
๐ฆ where this page comes from
- alpine 3.24: kcgi-doc 1.0.1-r0 ยท ISC
- nixos 26.05: kcgi 0.10.8
- nixpkgs unstable: kcgi 0.10.8
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms