Configuring a website on Apache2 with server-side includes

I recently got myself involved in helping with a website for a local club. In order to maintain it, I wanted to set up an Apache instance at home as well.

Luckily, in Ubuntu 9.10, it’s almost all set up by default. The only changes I had to make were to change the DocumentRoot directory and enable server-side includes. Here’s what I did:

Changing the document root

First I edited /etc/apache2/sites-available/default to put my document root in DocumentRoot, and also changed the two directory references that did point to /var/www to my new document root. Then I made sure all the parents of my document root had r+x permission for the Apache user.

Turning on server-side includes

My hosting facility has server-side includes turned on for .html. This is not the best use of resources, but this website doesn’t get enough traffic to make a difference. So I added:
AddType text/html .html
AddHandler server-parsed .html
Option Include (plus whatever options were there before)

to the two directories that used to be /var/www and /. After that, I had to enable mod_include with:
cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/include.load include.load

Then restart apache with sudo /etc/init.d/apache2 restart

Advertisements

Rate this:

Like this:

LikeLoading...

Related

This entry was posted on Saturday, January 22nd, 2011 at 2:37 pm and is filed under ubuntu, web. You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.