个人工具

UbuntuHelp:ApacheHTTPServerUpgrade

来自Ubuntu中文

跳转至: 导航, 搜索

Upgrade Apache HTTP Server

In Ubuntu 8.04, the apt-get install apache2 will install 2.2.8 version of the Apache server. However, this version of Apache server contains big memory leak issue especially when used with SSL. The goal is to upgrade Apache to any version downloaded, compile it, while maintain your configuration files in /etc/apache2 directory. This is an IN-PLACE upgrade.

Quick Install using Direct Deploy

You can read the rest of the wiki page for details on the upgrade process. To do a quick upgrade, go to Emergence Software and you can do this upgrade by downloading a deb package.

Manual Steps

Use apt-get to get the required packages:

apt-get install build-essential apache2 libpcre3-dev

Download the latest version from http://archive.apache.org

http://archive.apache.org/dist/httpd/httpd-2.2.11.tar.gz for example.

Run ./configure, make, make install

The goal is the build apache to over-ride existing versions and keep all configuration files in the standard /etc/apache2 directory. To do so, we need to ./configure using specific options.

./configure --with-pcre=/usr --enable-layout=Debian --with-program-name=apache2 --enable-logio --disable-actions --disable-authn-file --disable-authn-default --disable-authz-groupfile --disable-authz-host --disable-authz-user --disable-authz-default --disable-auth-basic --disable-include --disable-filter --disable-env --disable-setenvif --disable-mime --disable-status --disable-autoindex --disable-asis --disable-cgi --disable-negotiation --disable-dir --disable-userdir --disable-alias;

This will build apache2 with the same module options as the original apache2 from Ubuntu repository. We also use the debian layout, with program name apache2. That way, it will over-ride existing /usr/sbin/apache2 file, which is our goal of an in-place upgrade. Now, you can do:

make
sudo make install

SSLMutex Issue

If you use SSL or have mod_ssl enabled, you will need to specify the SSLMutex directory to avoid Apache2 startup problems. The easiest way to do this create ssl.conf file in the /etc/apache2/conf.d directory. The content of the file is below:

<IfModule mod_ssl.c>
SSLMutex file:/etc/apache2/logs/ssl_mutex
</IfModule>

Modify /usr/bin/apachectl file

We need to point the envvars to /etc/apache2/envvars. To do so, find and replace the path in apachectl to /etc/apache2/envvars. Once you finish editing and save it. Copy this file to /etc/init.d/apache2. This will be the new /etc/init.d/apache2 script.

Restart your Apache Server

sudo /etc/init.d/apache2 restart