Apache2.2 compile

Now let's compile Apache2.2. 1st get the latest source tarball from Apache.org, then move or copy the file to the /usr/src directory. Next extract the files, I cheat, I use Nautilis and Archive manager. The command lines are 'gunzip httpd-2.2.0.tar.gz' then tar something or other, I'll look it up later. Next, 'cd httpd-2.2.0' and type './configure --help > conf.help' as the output from this is large so capture it in a file and open your favorite editor, (I'm not going to get into a fight about emacs v. vi or anything like that) and read the conf.help file you just created, it will tell you about all the switches available to you. Now create a new file, I generally use the name of the machine w/ the package to be built as the name of the file so mine will be atlas.httpd.cnf and type './configure --enable-layout=RedHat' and save it, now open a terminal and 'cd /usr/src/httpd-2.2.0' and 'chmod +x atlas.httpd.conf'. Now this seems a bit much for just one line but if you have a long list of options you can just add them to the file and rerun it instead of having to retype or remember all those swithces you need, plus it helps document just what you did. I'm using the enable-layout=RedHat because CentOS is a Red Hat based distro, I like the layout and my other servers are Red Hat based so I won't have to remember that this or that server has a different directory structure. You could specify --enable-so but configure does this anyway. To check what will be installed read the config.log file created by configure, and add what you want to your .cnf file and rerun it. Now, 'make' and 'make install' and we're almost done. Finally start the server, 'apachectl -k start', start a browser, go to localhost and you should see the apache test page. Voila! But, Murphy's law being what it is, if the server doesn't start then you have to edit the config file to fix any error and try again. Apache2.2's config in a Red Hat layout is /etc/httpd/conf/httpd.conf but it's not all there you say, where's vhost or userdir directive's in this file? Well they aren't, they're in a sub -directory /etc/httpd/conf/extra/ and they all start with httpd- so httpd-vhosts.conf or httpd-userdir.conf is what your looking for. Userdir and most others are really just switches, you either turn 'em on or off. If you want to run virtual hosts though you'll have to edit httpd-vhosts.conf to set them up. So at the bottom of the much shorter httpd.conf you'll see the switches, just uncomment what you want and comment what you don't. just remember to restart the server each time you make a change. It may also interest you to know that httpd has command line arguments. If you type 'httpd -h' it will tell you what they are. -S tells you what vhosts you have set, -l will tell you which modules are compiled in, -M will tell you which modules have been loaded and how, compiled or at startup.