The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]
SSI - a quick guide 28 June 2000
Need more help on this topic? Click here
This article has no comments
Show me similar articles
Back in April, I did some quick tests on how to get SSI under Apache.   Here are my rough notes on that
SSI?  What's that?
SSI is Server Side Include.  It allows you to include files from within other files.  If you're getting serious about page composition, then php3 might be better suited to the task.  But SSI might be just what you need.

The following URL might be helpful to you:

http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html

And this message talks about ExecCGI and mod_include:

http://www.bitmechanic.com/mail-archives/modperl/current/0322.html

And this resource might be helpful:

http://support.pair.com/tutorials/ssi.html

Enabling SSi
I added the following to the Apache config file.  It may be apache.conf or http.conf, depending on what version of Apache you are using.  Be sure to edit the correct file.  HINT: if you change the .conf file and find it has no effect, perhaps you aren't changing the correct file. Search for this first.  It may already be there.
AddType text/x-server-parsed-html .shtml

Then I created the following file within the website:

$ more testssi.shtml
<html>
   <body>
      <!--#include file="testssi.inc"-->
   </body>
</html>

Then, I created this file:

$ more testssi.inc
hi mom

When you browse to the file testssi.html, you should see "hi mom".  If you don't, try the next section which might show you where you went wrong.

Problems and solutions
If your page shows up blank, but when you look at the source, you see this:
<html>
   <body>
      <!--#include file="testssi.inc"-->
   </body>
</html>    

Then you haven't turned on SSI.  Try again.  I found this in my apache.conf:

#
# To use server-parsed HTML files
#
#AddType text/html .shtml 
#AddHandler server-parsed .shtml

I uncommented those two lines, HUP'd apache:

   

and tried again.  Still no success.  So then I found this option "Includes".  So I added that to apache.conf under the directory in question.

<Directory "/www/test.freshports.org"> 
    Options Includes
</Directory>

And then it worked.


Need more help on this topic? Click here
This article has no comments
Show me similar articles