JC's notes on installing apache2 on Ubuntu linux 14.04
This contains hits at making apache2 work on ubuntu 14.04. It may help with other releases, too, but that's where I've most lately been testing this stuff.


Installation:

To make sure the server is properly installed, run:

	apt-get update
	apt-get install apache2

If you run "ps -ef", you should now see an "apache2" process in a ps listing. This has always worked (so far), so if it doesn't, I don't have any suggestions.


Enabling user directories:

	a2enmod userdir
	service apache2 restart

It's also a good idea now to edit /etc/group, and add your userid to any group with "www" in its name. This has been just "www" in the past, but "www-data" now seems common. I'm testing the use of both, with identical uids and gids. So far, this seems to work and makes it unnecessary to change old scripts that use "www".


Enabling .htaccess files:

The install and config stuff is in the /etc/apache2 directory. It's best to make a backup copy of every file here before editing it, so you can use diff to see what's changed, and to revert to the original easily if you really mess things up.

	cd /etc/apache2
	mv apache2.conf apache2.conf-orig
	cp apache2.conf-orig apache2.conf
	vi apache2.conf

Then I find all the uses of AllowOverride, and change the None to All, so I can use .htaccess files to control what happens in web directories. You'll also need to edit mods-enabled/userdir.conf and change the line AllowOverride FileInfo AuthConfig Limit Indexes to AllowOverride All Without this, .htaccess files won't work, and you'll get fatal errors in the server's log file for any directory with a .htaccess file. Don't forget:

	service apache2 restart


Enabling CGI scripts:

	a2enmod cgi
	service apache2 restart


Setting up Virtual Hosts:

Newer versions of apache2 use /var/www/ as the document root directory, and the virtual-host setup also starts in the same place.


SSI (Server-Side Includes):

Getting this working can be very difficult, because it doesn't seem to be fully documented anywhere. The biggest problem is that when you follow the guides, you often see total failure, with the only sypmtom being "AH00082: an unknown filter was not added: includes" in the error.log file. Most mentions of this say little more than "You must have done something wrong", and suggest that you go over all the details again to see what you missed, which doesn't solve the problem.

What I found finally fixed it was noticing that one of the steps (I didn't notice which one) created the file mods-available/include.load in /etc/apache2, and various comments about the changes in apache2's 2.4 directory structures is that to be effective, such files need to be in both the mods-available directory and the mods-enabled directory. A coherent explanation of this is still lacking, but when I tried: ln /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled and restarted the server, SSI commands suddenly started working.

A tricky part of this is that the guides all suggest including

   AddType text/html .shtml
   AddOutputFilter INCLUDES .shtml
to the httpd.conf file. First, there is no such file in the apache2 2.4.7 that I have. There is an apache2.conf, which seems to contain the same stuff, including these two lines commented out, and SSI doesn't work. If you uncomment the AddType command, no errors appear, but SSI fails as before. If you uncomment the AddOutputFilter command, the "unknown filter" message appears in error.log, and SSI still fails. But you get the error both during server restart and when a download of the .shtml file comes in. So the problem has something to do with something with "include" in its name. The include.load file turns out to be the culprit, which gets installed in only one of the two places where it should be found.

Of course, I don't understand much of this yet, so there might be a better explanation of it all somewhere that I don't know about.