Upgrade to Apache2

I decided it was time to upgrade my server to run Apache 2, now that version 2.2 was available it looked like all the bugs from the first 2.0 releases had been sorted.I could just have added the Debian packages and made it easy on myself, but thought I would give it a go from source and rebuild PHP too so it would make use of the new server.

I figured it would be good practice for building it on my PowerBook for when I am away next week.

First off I got the latest source code from the Apache website, then extracted it:

tar xvfj httpd-2.2.0.tar.bz2

then enter the newly extracted httpd directory

cd httpd-2.2.0

Now we need to configure Apache before we build it. I want it to run with the prefork multi-processing module to ensure that any third party modules I use in the future are thread safe. I also want to enable WbDAV support to make it easier for passing files around to the server so I used the following configure command:

./configure –prefix=/usr/local/apache –enable-dav –with-mpm=prefork –enable-so

I added the prefix in as I don’t want it to overwrite my existing 1.3 installation just yet till I make sure its working right.

After it configures its:

make

& as root

make install

Now its time to edit the config file in /user/local/apache/conf/httpd.conf

Firstly I want to change the document root directory (not the server root directory) to /var/www as thats where the existing Apache installation serves its files from. Whilst we have the file open we might as well make a couple of other changes, firstly add the line

AddType application/x-httpd-php .php

to the list of AddTypes, this will ensure it will handle PHP files when we recompile PHP to work with it. We also need to add index.php to the list of files Apache will give if a directory is requested, by default it will only give index.html.

With those changes made start apache with the command:

/usr/local/apache/bin/apachectl start

Now you should find that Apache is running on port 80.

Now we need to rebuild PHP so that it knows about apache 2.

So we reconfigure it with the new config command:

./configure –with-apxs2=/usr/local/apache/bin/apxs –with-mysql –with-ffmpeg=YES –with-gd –with-zlib-dir –enable-mbstring

Then the usual:

make

& as root

make install

Now I just need to figure out why WebDAV isn’t working….