Converting from Apache 1.3 to Apache 2
Note: this documentation is fairly old, and may not really be relevant any more. (Does anyone even use Apache 1.3 these days?)
These are my rough notes on how I converted daystrom, running Debian sarge, from Apache 1.3 to Apache 2.0. They're not very clean, but maybe they might help someone out.
First, install apache2:
apt-get install apache2 apache2-common
Since Apache 1.3 is already booted, this won't run, but it will install.
Next, edit /etc/default/apache2 and change:
# 0 = start on boot; 1 = don't start on boot NO_START=1
to
# 0 = start on boot; 1 = don't start on boot NO_START=0
That was caused by Apache 1.3 already having been running.
Next is to do some intitial configuration for Apache. Here's what's in the configuration directory originally:
daystrom:/etc/apache2# ls -l total 72 -rw-r--r-- 1 root root 2266 Sep 5 06:16 README -rw-r--r-- 1 root root 12482 Sep 5 06:16 apache2.conf drwxr-xr-x 2 root root 4096 Sep 5 06:15 conf.d/ -rw-r--r-- 1 root root 748 Sep 5 06:10 envvars -rw-r--r-- 1 root root 268 Oct 20 19:55 httpd.conf -rw-r--r-- 1 root root 12441 Sep 5 06:16 magic drwxr-xr-x 2 root root 4096 Oct 20 20:05 mods-available/ drwxr-xr-x 2 root root 4096 Oct 20 20:07 mods-enabled/ -rw-r--r-- 1 root root 12 Oct 20 19:56 ports.conf drwxr-xr-x 2 root root 4096 Oct 20 19:59 sites-available/ drwxr-xr-x 2 root root 4096 Oct 20 20:01 sites-enabled/ drwxr-xr-x 2 root root 4096 Sep 5 06:15 ssl/
First, edit ports.conf and have Apache2 listen on something other than port 80 for testing.
Listen 9080
Next, edit apache2.conf and make sure the server is running as http:public:
#User www-data #Group www-data User http Group public
Next, configure virtual hosts. We'll create an entry for each of the hosts we care about within sites-available/ and then symlink into sites-enabled/:
daystrom:/etc/apache2# ls -l sites-* sites-available: total 16 -rw-r--r-- 1 root root 1871 Oct 20 19:59 cedar-solutions -rw-r--r-- 1 root root 365 Oct 20 19:59 daystrom -rw-r--r-- 1 root root 29 Oct 20 19:58 default -rw-r--r-- 1 root root 1167 Oct 20 19:58 default.orig sites-enabled: total 0 lrwxrwxrwx 1 root root 36 Oct 20 19:55 000-default -> /etc/apache2/sites-available/default lrwxrwxrwx 1 root root 34 Oct 20 20:01 001-cedar-solutions -> ../sites-available/cedar-solutions lrwxrwxrwx 1 root root 27 Oct 20 20:00 002-daystrom -> ../sites-available/daystrom
The default site just contains one line:
NameVirtualHost *
The others contain exactly the same virtual hosts directives from Apache 1.3.
At this point, Apache2 should boot and you should be able to test on that special port (9080). Make sure that the default site is cedar-solutions.com and that the following URLs work:
http://daystrom:9080/ http://cedar-solutions.com:9080/ http://daystrom.yi.org:9080/ http://cedar-solutions.com:9080/ftp/software/ http://cedar-solutions.com:9080/listarchives/ http://cedar-solutions.com:9080/listarchives/cedar-backup-users/threads.html http://daystrom:9080/cgi-bin/bugzilla/index.cgi
The next step is to get PHP (gallery) and Tomcat (JSPWiki) applications working. First, PHP:
apt-get install libapache2-mod-php4
Unfortunately, this seems to affect Apache configuration, removing the apache2-mpm-worker package and replacing it with apache2-mpm-prefork instead. This is probably because PHP4 is not thread-safe.
After this step, you'll probably want to double-check some of the same URLs again to be sure that installing the prefork version rather than the worker version hasn't broken anything.
Next, enable mod-rewrite, which is required for URL rewriting (so you can say gallery/whatever to get the "whatever" gallery).
daystrom:/etc/apache2/mods-enabled# ln -s /etc/apache2/mods-available/rewrite.load
Then, check whether gallery works. Make sure to check some sub-galleries, too, and click on a few pictures.
http://daystrom.yi.org:9080/gallery/
Unfortunately, with the default gallery configuration, these URLs will work both from daystrom.yi.org and cedar-solutions.com. This means commenting the Alias line in /etc/apache2/conf.d/gallery and putting it into the daystrom virtual host configuration to ensure that things work only from daystrom.yi.org.
Next, get Tomcat working:
apt-get install libapache2-mod-jk2
Configuring this is a little more difficult than PHP4.
daystrom:/etc/apache2/mods-available# ls -l jk2* -rw-r--r-- 1 root root 240 Aug 17 2004 jk2.conf -rw-r--r-- 1 root root 58 Apr 12 2004 jk2.load daystrom:/etc/apache2/mods-available# cat jk2.conf # To enable mod_jk2, customize workers2.properties* from # /usr/share/doc/libapache2-mod-jk2/examples and copy it to # /etc/apache2/workers2.properties. Then uncomment the following line: #JkSet config.file /etc/apache2/workers2.properties
I thought the "minimal" example was overly complicated, so I went to the documentation and ended up with this in workers2.properties:
# Define the communication channel [channel.socket:localhost:8009] info=Ajp13 forwarding over socket tomcatId=localhost:8009 # JSPWiki [uri:/JSPWiki] info=Map main Wiki URL [uri:/JSPWiki/*] info=Map the whole Wiki webapp
At this point, the JSPWiki URLs should work:
http://cedar-solutions.com:9080/JSPWiki/Wiki.jsp?page=Main http://daystrom.yi.org:9080/JSPWiki/Wiki.jsp?page=Main http://daystrom:9080/JSPWiki/Wiki.jsp?page=Main
Of course, this assumes you had the connector working from Tomcat's end before, from Apache 1.3.
Technically, I only want the Wiki to work from cedar-solutions, not daystrom, but I guess I don't care enough right now to figure out how to restrict it.
At this point, it should be safe to stop apache 1.3, update the port configuration for apache2, and then start apache2. Once you restart, dig through the web site and make sure things still continue to work properly - Wiki, CGIs, etc.
The only other thing that's required is to update the log formats in the file so that Apache2 outputs what Analog expects. I added this below the error log:
# Access log, in custom form CustomLog /var/log/apache2/access.log combined
Then, update /etc/analog-http.conf and point it at the apache2 log files rather than the apache log files.
At this point, you may want to use dpkg-reconfigure or some other method to stop apache 1.3 from starting on boot, so it doesn't mess with Apache2 on port 80.