Just SSI

Posted: July 05, 2026 - Updated: July 05, 2026

What it is

It is a very simple rendering engine that allows you to put dynamically generated content right into plain HTML files.

It comes as a built-in extension of a web server, and native support can be found in Apache HTTP Server (mod_include), NGINX (ngx_http_ssi_module), Microsoft IIS (ServerSideInclude), Apache Tomcat, and many others.

General pattern is:

<!--#directive parameter="value"-->

An example is this tag, which after rendering shows the latest page modification date:

<!--#flastmod file="index.html" -->

And for that, you do not need any application, handlers, or other servers. This is built into the existing one.

Other examples

Use of echo and one of the predefined global variables:

This file last modified <!--#echo var="LAST_MODIFIED" -->

Include the result of a CGI script:

Page visitors <!--#include virtual="/cgi-bin/counter.pl" -->

Or just include another HTML file as part of this page:

<!--#include virtual="/footer.html" -->

Alternative via exec:

Page visitors <!--#exec cgi="/cgi-bin/counter.pl" -->

A direct call to a local shell script, inlining its result:

<!--#exec cmd="perl /path/to/perlscript arg1 arg2" -->

This is clear:

<!--#exec cmd="ls" -->

Programming with SSI

Declaring a variable:

<!--#set var="Zed" value="${REMOTE_HOST}_${REQUEST_METHOD}" -->

Conditional rendering:

<!--#if expr="\"$DOCUMENT_URI\" = \"/foo/file.html\"" -->
in foo
<!--#elif expr="$a = test1 && $b = test2" -->
in bar
<!--#else -->
in neither
<!--#endif -->

Conclusion

There are many directives in SSI, but in general, having variables, expressions, calls to other programs, and generated output from programs and other plain files is enough to generate smart dynamic pages without having anything other than a plain static server. Yes, many static server hoststers do support SSI.

Comments