CGI(oh) LOCAL CGI(oh) cgi - configuration and usage CGI script - The script needs an interpreter (eg.: #!/bin/ksh). - the first output line needs to be 'echo Content-type: text/html '. - the second output line needs to be empty 'echo ""'. - copy required binaries (including interpreter) to /var/www/bin/. - copy dependencies to the corresponding structures in /var/www. - binaries and libraries must be owned by 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 $ doas install -o www /usr/lib/libz.so.6.0 /var/www/usr/lib/ $ doas install -o www /usr/libexec/ld.so /var/www/usr/libexec/ httpd.conf The location with the cgi scripts needs to have the fastcgi socket defined. server default { ... location "/$CGI_PATH/*" { fastcgi socket "/run/slowcgi.sock" } } EXAMPLE curl This site has the location "/:*" defined and when accessing from curl it will display the ascii version of the files. location /:* { fastcgi { param SCRIPT_FILENAME "$CGI_PATH_FROM_CHROOT/$SCRIPT"} } httpd.conf server default { listen on * port 80 root "/htdocs/$DIR" location "/$CGI_PATH/*" { fastcgi socket "/run/slowcgi.sock" } #curl access location "/:*" { fastcgi { param SCRIPT_FILENAME "$CGI_PATH_FROM_CHROOT/$SCRIPT"} } } TESTING chroot /var/www to test the script and ensure all dependencies are available and have the correct permissions. SERVICES 1. Test: doas slowcgi -dnvvv 2. Enable and start doas rcctl enable slowcgi doas rcctl restart slowcgi 3. Restart httpd. SEE ALSO web(oh) , httpd(oh) - examples: figlet example cgi: /cgi/example.cgi , search: /cgi/search.cgi - text files: , , - OpenBSD manpages: slowcgi(8) , rcctl(8) links - Serving Fossil via httpd on OpenBSD: https://www.fossil-scm.org/home/doc/trunk/www/server/openbsd/fastcgi.md AUTHORS ohazot(oh) | about(oh) | ohazot.com: https://ohazot.com OpenBSD 7.7| Created:2025-10-03|Updated:2025-10-25|| CGI(oh)