CCL Home Page
Up Directory CCL t013.html

Jan K. Labanowski: "Tomcat, servlets, JSPs and other friends"

SSI -- Server Side Includes

This approach was first used in HTTPD server (from NCSA), and then incorporated into Apache. Now, it is a de facto standard and present in many commercial Web servers. How it works?

  • File need to have special extension. Usually .shtml is used.
  • Files with the .shtml are processed through a filter which looks for HTML comments <!-- #somekeyword... --> with a special syntax.
  • The content of the special comment is replaced with dynamic content.

There are many SSIs. The popular SSIs are:

  • <!--#include file="somefile" --> includes a file at in place of the tag.
  • <!--#set var="script_dir" value="/usr/local/bin" --> sets an environment variable (so the next call to a script can use it
  • <!--#exec cgi="/cgi-bin/" --> executes a CGI script
  • <!--#exec cmd="ps -ef | grep nobody" --> executes a system commad (here it lists processes run by user nobody

Detailed syntax of SSH is avaliable from Apache Web site:

Modified: Tue Feb 12 21:18:53 2002 GMT
Page accessed 2560 times since Tue Feb 4 16:10:41 2003 GMT