Ubuntu 10.04: Enable SSI in Apache2

So heres to scoop on how to get ssi working on a default install of apache on Ubuntu 10.04:

Got this data from:
https://help.ubuntu.com/community/ServerSideIncludes

Enable the Includes module

a2enmod include

This creates a SymbolicLink in mods-enabled of the config file in mods-available. See also RootSudo.

Editing config

Open the /sites-available/default file…

gksudo gedit /etc/apache2/sites-available/default

find this section…

<Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
</Directory>

and edit it to look like this:

<Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews +Includes
        AllowOverride None
        Order allow,deny
        allow from all
        AddType text/html .shtml
        AddOutputFilter INCLUDES .shtml
        DirectoryIndex index.shtml
</Directory>

You need to add +Includes to the end of the end of the Options, and two new lines after the commented-out lines.

You can leave out the final added line if you don’t want includes in index pages.

Restart Apache2

sudo apache2ctl restart

Test it works

Create a SSI test file and save it under /var/www/ssi-test.shtml.

<html>
<head>
<title>SSI Test Page</title>
</head>
<body>
<!--#echo var="DATE_LOCAL" -->
</body>
</html>

In your WebBrowser, go to http://127.0.0.1/ssi-test.shtml.

If your browser displays the local date (eg Saturday, 06-Aug-2005 23:05:21 CEST), SSI is working!

This article has 3 Comments

  1. I was very pleased to find this site.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you post.

Leave a Reply

Your email address will not be published. Required fields are marked *