![]() |
|
|
U Upgrade Apache 1.3 to apache2.0 in Debian Introduction
upgrade from Apache 1.3 to Apache 2.0 on Debian Sarge, and it's
not as difficult as you might think. Despite some differences in the configurations of the two versions of Apache, the upgrade can be a surprisingly smooth process if you plan well. This assumes that you already have Apache 1.3 installed on Debian Sarge, have root access to the server, and have one or more sites configured as virtual hosts in your /etc/apache/httpd.conf file. Installation The first step is to install the Debian packages for Apache 2. Run from your command prompt #apt-update then you run below command # apt-get install apache2 apache2-common This will install the Apache server and support packages. If you receive a "Couldn't find package apache2" error, or similar, check your package resource list (/etc/apt/sources.list) to make sure that your list of package archives is correct. If you want to install PHP support for your apache server you need to install the libapache2-mod-php4 package for this #apt-get install libapache2-mod-php4 If you want to install mod_python support for your apache server you need to install the libapache2-mod-python package for this
#apt-get install libapache2-mod-python Configuring Virtual hosts The next step is to configure your virtual hosts. The configuration file layout is different between Apache 1.3 and Apache 2.0 on Debian. While Apache 1.3 typically has all of its virtual hosts information in the /etc/apache/httpd.conf file, Apache 2.0 is set up to look for virtual host configurations in the /etc/apache2/sites-enabled directory. Say, for instance, that your /etc/apache/httpd.conf virtual hosts section looks like this:
# Named VirtualHosts This could translate in Apache 2 into one or more separate configuration files under /etc/apache2/sites-enabled. While you can keep all of your virtual host entries in one configuration file, it's usually best to split them into separate configuration files for each host. With Apache 1.3, the first entry of your VirtualHosts section serves as your "default" site -- in other words, if someone comes to a site that's not configured in your VirtualHosts section correctly, but is specified in public DNS as your server's IP address, he will be sent to the default Web site. With Apache 2.0, the default site is instead the first file (in alphabetical order) in the /etc/apache2/sites-enabled directory. After initial installation, there will be a symlink from 000-default in this directory to /etc/apache2/sites-available/default. As you can see from this, Apache 2.0 offers another level of abstraction in virtual hosts by recommending putting the actual files in /etc/apache2/sites-available and then symlinking from there to /etc/apache2/sites-enabled. You can see the following example in apache2. It makes it much easier to manage when there are a large number of virtual hosts on a server. In the example above, you would create two files, /etc/apache2/sites-available/default and etc/apache2/sites-available/test1.com. The /etc/apache2/sites-available/default file would look like this:
NameVirtualHost * And the /etc/apache2/sites-available/test1.com would look like this:
<VirtualHost *> Creating Symlinks Create symlinks to the files in the /etc/apache2/sites-enabled directory with the ln -s or a2ensite commands: Using ln -s ln -s /etc/apache2/sites-available/test1.com /etc/apache2/sites-enabled/test1.com. Using a2ensite
a2ensite /etc/apache2/sites-available/test1.com
/etc/apache2/sites-enabled/test1.com. Example:- If you want to load rewrite module for your apache use the following #a2enmod rewrite Now that you have the virtual hosts configured, it's time to test. To start Apache 2, type /etc/init.d/apache2 start. Fire up a browser and head to www.test1.com:8080. Obviously, this will only work assuming you have a correct virtual host entry for a hostname which has DNS pointing to your server rather than www.test1.com. Alternatively, you can add an entry in the /etc/hosts file on the machine that you're browsing from to fool it into thinking it should be going to the IP address of your server. If Apache 2 didn't start correctly, you may see errors when running /etc/init.d/apache2 start, and you will need to resolve some issues before you can proceed. Check the /var/log/apache2/error.log for details on any problems. If your sites are running PHP with PostgreSQL or MySQL database backends, as well as a Zope/Plone instance that's being served from Apache using mod_rewrite. As a result,you need to install the libapache2-mod-php4 and libapache2-mod-proxy-html packages. In addition,you need to copy my existing php.ini file (/etc/php4/apache/php.ini) to /etc/php4/apache2/php.ini to make sure all your PHP settings were preserved. You also need to create symlinks from /etc/apache2/mods-available/proxy.load and rewrite.load to the /etc/apache2/mods-enabled directory. Once again, Apache 2 is modularizing its configuration layout. Your final step to resolve Apache 2 startup issues was to symlink /etc/apache/logs to /etc/apache2/logs, as that was my log file directory. you're now ready to migrate to Apache 2.0 Stop Apache 2 if it's running by using the command /etc/init.d/apache2 stop, and change the /etc/apache2/ports.conf to use port 80. Stop Apache 1.3 with /etc/init.d/apache stop, and then fire up Apache 2 with /etc/init.d/apache2 start.
The
final steps include making sure Apache 2 will start when the
server is rebooted, and making sure Apache 1.3 won't. There are
a few ways to remove Apache 1.3 from the services that start on
boot. One is to remove the symlinks for Apache in the /etc/rc*.d
directories. Another is to use the sysv-rc-conf run-level
configuration editor. This is not installed on Debian systems by
default, but can be installed using apt-get install sysv-rc-conf. Important Points need to check register_globals
When you upgrade Apache you have to install
libapache2-mod-php4 (well you don't have to but I suggest you
do). The first problem is with register_globals which is set to
on in the default php.ini for Apache 1.3 but off in the default
php.ini for Apache 2. If your website makes use of $DOCUMENT_ROOT
then this little difference will render your site useless until
you change it to on. There are good reasons to have
register_globals set to off, and you should modify your site to
work with it set to off, but the lack of consistency will likely
catch you out.
The second big problem is with the fact that when you
install Apache 2 after Apache 1.3 it doesn't automatically
update the php.ini files so that the related packages can be
used with Apache 2. The result is that database access doesn't
work and you get nasty error messages like this:
The solution to this is to reconfigure the
php4-pgsql and php4-mysql packages with:
|