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
Now, the compilation is complete. You can edit your httpd.conf install php module or other modules and you can stop the old apache and start the new apache
#this will kill the old apache process and will start the new apache process kill `cat /home/web/bakapache/logs/httpd.pid` /home/web/apache/bin/apachectl -k start
Note:If you upgraded from apache 2.2.* you can just copy "conf" and "modules" from your old apache and they will run without problems, because modules are built with Apache 2.0 handler, and they are compatible
#this will copy configuration files and modules rm -R /home/web/apache/conf cp -R /home/web/bakapache/conf /home/web/apache/conf #copy modules rm -R /home/web/apache/modules cp -R /home/web/bakapache/modules /home/web/apache/modules
Share this with the world
Related
Comments
No comments at this timeMake yourself heard