peace love linux logo

New Social Network

Apache2 SSI Installation with Ubuntu Linux


Tested on:
- Ubuntu Linux 10.10 Maverick Meerkat (2010-11-21)
- Ubuntu Linux 7.10 Gutsy Gibbon
- Ubuntu Linux 6.06 Dapper Drake
- Ubuntu Linux 5.10 Breezy Badger

  1. Optional: Install the Apache2 httpd server if not already installed.
    sudo apt-get install apache2

  2. Create the following symlink.
    sudo ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled

  3. Open the /sites-available/default file and add the text with the yellow background.
    sudo gedit /etc/apache2/sites-available/default
    
    ...
    <Directory /var/www/>
    	Options Indexes FollowSymLinks MultiViews +Includes
    	AllowOverride None
    	Order allow,deny
    	allow from all
    	AddType text/html .shtml
    	AddOutputFilter INCLUDES .shtml
    </Directory>
    ...
    
    

  4. Restart Apache2 and create a SSI test file (ssi-test.shtml) and save it in the directory /var/www/.
    sudo apache2ctl restart && sudo gedit /var/www/ssi-test.shtml
    <html>
    <head>
    <title>SSI Test Page</title>
    
    </head>
    <body>
    <!--#echo var="DATE_LOCAL" -->
    </body>
    </html>
    

  5. Test SSI in your web browser.
    http://localhost/ssi-test.shtml
  6. If your browser displays the local date (eg Saturday, 06-Aug-2005 23:05:21 CEST), SSI is working!

related links

Apache Tutorial: Introduction to Server Side Includes

Ubuntu Wiki: ServerSideIncludes


acknowledgment

Joachim Noreiko - code optimization


alternative to step 2 "sudo ln -s /etc/..."

Open the httpd.conf file and add the text with the yellow background.
sudo gedit /etc/apache2/httpd.conf
# This is here for backwards compatability reasons and to support
#  installing 3rd party modules directly via apxs2, rather than
#  through the /etc/apache2/mods-{available,enabled} mechanism.
#
#LoadModule mod_placeholder /usr/lib/apache2/modules/mod_placeholder.so

LoadModule include_module /usr/lib/apache2/modules/mod_include.so