SSI(8)
π NAME π
ssi β the Server-Side-Includes CGI program, bestie π«Ά
β¨ SYNOPSIS β¨
ssi
like. that's it. no flags. no args. she just is. π
πΈ DESCRIPTION πΈ
okay so picture this: ssi is an external CGI program that does literally the exact same thing as the built-in server-side-includes feature that lives inside a bunch of HTTP daemons. she was written to hang out with thttpd(8) and merecat(8), but she's lowkey easy to adapt to other systems too. flexible queen π
there are two ways to use her:
the modern way π β you use a .shtml pattern in merecat.conf(5) to trigger the SSI script, which means you gotta enable the SSI module. and the traditional thttpd(8) approach π¦.
let's start with the relevant settings you need in merecat.conf:
ssi {
enabled = true
pattern = "**.shtml" # default
cgi-path = "cgi-bin/ssi" # default, web server root is used
}
the traditional thttpd way runs ssi as a plain simple CGI script, which means you gotta place the ssi binary in the web server CGI area and enable CGI. then you set up URLs where the path to the document you wanna parse is the "pathinfo". that's the part of the URL that comes after the CGI program name. iykyk β¨
for example, if the URL to this program is:
http://www.acme.com/cgi-bin/ssi
and the url for the document is:
http://www.acme.com/users/wecoyote/doc.html
then the compound URL would be:
http://www.acme.com/cgi-bin/ssi/users/wecoyote/doc.html
periodt. that's the whole vibe π
π INCLUDE FORMAT π
the format description below is adapted from http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html. (not me linking my sources, academic icon behavior π)
all directives are formatted as SGML comments inside the document. why? just in case the document ever finds itself in the client's hands unparsed π. every directive has this format:
<!--#command tag1="value1" tag2="value2" -->
note: see how there's no space between the initial HTML comment start and the #command? that's not a typo, bestie, that is explicitly stated in the standard and strictly enforced by all web servers implementing SSI. do not add a space. do not be cute about it. the server will not be cute back. π
each command takes different arguments, and most of them only accept one tag at a time. here's the breakdown of the commands and their associated tags:
π¦ config
the config directive controls various aspects of the file parsing. there are two valid tags... and also a third one that just kind of showed up, we'll get there:
timefmtβ gives the server a new format to use when providing dates. it's a string compatible with thestrftime(3)library call. β°sizefmtβ decides how the size of a file gets formatted. valid choices arebytes, for a formatted byte count (formatted like1,234,567), orabbrevfor an abbreviated version showing the number of kilobytes or megabytes the file occupies. πerrmsgβ overrides the default;"[an error occurred while processing this directive]". so iconic of her to have a default error message ready to go π
π include
inserts the text of another document into the parsed document. and bestie, the inserted file gets parsed recursively, so it can contain server-side-include directives too. it's giving infinite nesting potential. this command accepts two tags:
virtualβ gives a virtual path to a document on the server.fileβ gives a pathname relative to the current directory.../cannot be used in this pathname, nor can absolute paths be used. nope. no escape attempts. the server said no π«
β¨ echo
prints the value of one of the include variables (defined below). any dates get printed subject to the currently configured timefmt. the only valid tag for this command is var, whose value is the name of the variable you wish to echo. π£οΈ
π fsize
prints the size of the specified file, subject to the sizefmt parameter of the config command. valid tags are the same as with the include command. π
π
flastmod
prints the last modification date of the specified file, subject to the formatting preference given by the timefmt parameter to config. valid tags are the same as with the include command. π°οΈ
π§ VARIABLES π§
a whole bunch of variables are made available to parsed documents. on top of the CGI variable set, these following variables are also available:
DOCUMENT_NAMEβ the current filename. πDOCUMENT_URIβ the virtual path to this document (such as/~robm/foo.shtml). πQUERY_STRING_UNESCAPEDβ the unescaped version of any search query the client sent. πDATE_LOCALβ the current date, local time zone. subject to thetimefmtparameter to theconfigcommand. πDATE_GMTβ same asDATE_LOCALbut in Greenwich mean time (GMT). πLAST_MODIFIEDβ the last modification date of the current document. subject totimefmtlike the others. π
π SEE ALSO π
merecat(8), merecat.conf(5), strftime(3)
go read those too, bestie, they're part of the lore πβ¨
π«Ά AUTHORS π«Ά
- Jef Poskanzer
<jef@mail.acme.com>wrote the original for use withthttpd. the OG, the blueprint, we stan π - Joachim Wiberg
<troglobit@gmail.com>added minor features and a trigger inmerecatfor.shtmlpages. the upgrade arc π
π BUGS π
does not implement all "modern" SSI directives are supported. e.g., exec cgi and exec cmd or any control directives like if, elif, else, endif, etc. so like... some of the fancy modern stuff is simply not here yet. she's doing her best. π
patches and pull-requests are welcome :) β for real, fr fr, slide into the repo π«Ά
and that's the whole page, bestie! this little love letter to ssi shipped with merecat (2.32) back on Aug 3, 2019 π thank you for coming to my ted talk, now go parse some includes β¨ππ¦
π¦ where this page comes from
- debian bookworm: merecat 2.31+git20220513+ds-4.1 Β· BSD-2-Clause
- debian trixie: merecat 2.31+git20220513+ds-5 Β· BSD-2-Clause
- ubuntu noble: merecat 2.31+git20220513+ds-4.1build2 Β· BSD-2-Clause
- ubuntu noble: merecat 2.31+git20220513+ds-4.1ubuntu0.1 Β· BSD-2-Clause
- ubuntu questing: merecat 2.31+git20220513+ds-5
- ubuntu resolute: merecat 2.31+git20220513+ds-9 Β· BSD-2-Clause
- ubuntu stonking: merecat 2.31+git20260330+ds-2build1 Β· BSD-2-Clause
- Copyright (c) 1995-2015 Jef Poskanzer <jef@mail.acme.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms