_ _ ___ | |__ __ _ _______ | |_ / _ \| '_ \ / _` |_ / _ \| __| | (_) | | | | (_| |/ / (_) | |_ \___/|_| |_|\__,_/___\___/ \__|
ohazot | | docs | | about |
cgi
—
configuration and usage
CGI
This should be the first line to ensure browsers can read it:
echo "Content-type: text/html"
- copy binaries to /var/www/bin/
- copy dependencies to the corresponding structures in /var/www
example
$ whereis grep /usr/bin/grep $ ldd /usr/bin/grep Start End Type Open Ref GrpRef Name 0000030be12e4000 0000030be12ef000 exe 1 0 0 /usr/bin/grep 0000030e32295000 0000030e322b3000 rlib 0 1 0 /usr/lib/libz.so.6.0 0000030eb72e8000 0000030eb73dd000 rlib 0 1 0 /usr/lib/libc.so.96.1 0000030de67ed000 0000030de67ed000 ld.so 0 1 0 /usr/libexec/ld.so $ cp /usr/lib/libz.so.6.0 /var/www/usr/lib/ $ cp /usr/libexec/ld.so /var/www/usr/libexec/
httpd.conf
server "default" { ... location "/$CGI_PATH/*" { fastcgi socket "/run/slowcgi.sock" } }
EXAMPLE
server "default" { listen on * port 80 root "/htdocs/$DIR" location "/$CGI_PATH/*" { fastcgi socket "/run/slowcgi.sock" } #curl access location "/:*" { root "/htdocs/ohazot/repo" fastcgi { param SCRIPT_FILENAME "$CGI_PATH/$SCRIPT"} } location "/$LOCATION/*" { directory auto index } errdocs "$ERRORS_DIR" } types { text/css css text/html html text/plain txt oh sh awk bc }
SERVICES
doas slowcgi -dnvvv
doas rcctl enable slowcgi doas rcctl restart slowcgi
TODO
- Review and add example.
SEE ALSO
OpenBSD manpages
files
<cgi.oh>