Upgrade to apache 2.2.6 without downtime

2007-09-21

I will show you how to upgrade your apache to the latest version without downtime, and also some tips to get out the best performance from your apache.

First, rename your apache folder to something like "apachebak". This allows you to compile the new apache in the same directory as the old apache, and you can have a backup of your old apache, if something goes wrong.

#change to apache parent directory
cd /home/web/
mv apache apachebak

Next thing is to get the sources. If you don't have them

#change to your sources directory
cd /home/sources/
wget http://www.apache.org/dist/httpd/httpd-2.2.6.tar.gz

Now extract the sources

gunzip < httpd-2.2.6.tar.gz | tar xvf -

Before I start compiling, I use some gcc flags to speed up apache. You can read how to compile with optimization, to optimize the code for your machine

#this enables compilation with my both cores
#i have a dual core machine and i must use -j3, 
#if you have a quad core machine for example you must use -j5
export MAKEOPTS=-j3 
#these are CFLAGS for my machine, core 2 duo
export CFLAGS="-O3 -march=nocona -freorder-blocks /
-fno-reorder-functions -mmmx -mno-mmx -msse -msse2 /
-mno-sse2 -msse3 -mno-sse3 -mssse3 -mno-ssse3 -mfpmath=sse"
export CXXFLAGS="-O3 -march=nocona -freorder-blocks /
-fno-reorder-functions -mmmx -mno-mmx -msse -msse2 /
-mno-sse2 -msse3 -mno-sse3 -mssse3 -mno-ssse3 -mfpmath=sse"

If you want to compile your code on 64 bit linux, apache has a bug that fails compilation. Here is how to fix the apache bug

And now we can start the compilation

./configure --prefix=/home/web/apache --enable-so --enable-rewrite --disable-cgi --disable-cgid --disable-autoindex --with-mpm=worker --enable-nonportable-atomics=yes  --enable-lib64 --libdir=/usr/lib64 && make && sudo make install

Note: If you have a 32 bit machine then remove "--enable-lib64 --libdir=/usr/lib64" from the configure line

Share this with the world

Related

Comments

Darth Savage

Thanks for putting this page together...saved me some time in compiling 64-bit Apache 2.2.x. Wanted to pass on one note of interest:

Setting --libdir=/usr/lib64 and compiling as a non-root user may cause problems during make install, as the install portion of the build will want to place some apr-related libraries in the directory that you set as libdir. So, if you are running an OS that already has files present that are related to apr via an already installed package, the make install will fail.

In my case, I set --libdir=$APACHE_HOME/lib64 and the make install completed without a hitch. The apr-related libraries are placed in $APACHE_HOME/lib64 and the make install process also updates the envvars file to include a LD_LIBRARY_PATH declaration which includes the --libdir specified during configure, so the proper apr-related libraries will be used during runtime.

Thanks again!

Posted on 2008-07-14 11:18:58
Waitman

don't these contradict each other? enable and disable?
-mmmx -mno-mmx
-msse2 -mno-sse2
-msse3 -mno-sse3
-mssse3 -mno-ssse3

Posted on 2008-09-23 15:43:49

Make yourself heard

Categories

Subscribe

All Posts

Tutorials posts

All Comments

This post comments

© Copyright CodeAssembly

All code is licensed under GPL, unless otherwise noted