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

No comments at this time

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