SolutionBase: Setting up a simple Web site with Apache 2.2

Apache was successfully installed

This gallery is also available as a TechRepublic article.

With the release of Apache 2.2, the Apache group has improved upon an already outstanding service. If you're in the market for a new web server, or are interested in putting Apache 2.2 through its paces, it's very easy to create a simple Apache site on either Windows or Linux. Here's how it works.


The installation of Apache 2.2 on Linux can be handled in approximate 73,624 different ways, give or take a few. That is to say there is a variety of different ways you can install Apache, some dependent on your preferred Linux distribution. For example, if you're a Red Hat or Fedora fan, RPM is your best choice. If you're using some other distribution, you may be able to use RPM, or your distribution may have its own package format.

If you're installing your Linux server from scratch, you can usually choose Apache as an installation option. If you have this option, take it, unless you need something unusual in your installation.

If you're using an existing server and don't want to reinstall the OS, or if you want to have the most granular control over how your Apache installation is configured, your best bet is to build Apache from source code. If you're somewhat new to Linux and the sound of this makes you nervous, it's actually a whole lot easier than it sounds. Better yet, this option works on any Linux distribution out there. It even works for Windows if you have an appropriate compiler installed.

For the example installation in this section, I'm going to build Apache 2.2 from source and install it on a Fedora Core 4 server. You won't see anything fancy in this build--just the basics will be included, but your Linux server will be serving web pages in just minutes!

Before you can compile Apache, you need the source, which is available for download from the Apache web site. As of this writing, the latest version of Apache available is 2.2.0. I've saved the file, named httpd-2.2.0.tar.gz to a folder named /usr/src/apache-2.2 on my server. I like to save installations in this location so I have them for the future.

The next few commands are entered from a command line. I've put them, in order, in Table A.

When you're done with the steps in Table A, browse to your new server. You should get a "It works!" message as shown above.

Before you do too much, you should configure Apache to automatically start when your system boots. The steps to make this happen depend on which Linux distribution you're using. Please refer to your system docs for more information. Until you get that set straight, use the "start" command in the last part of Table A.

Table B lists the various modules available for your control during the ./configure portion of the instructions in Table A. I've indicated whether module is enabled by default or disabled by default, the module name, the configure directive you need to use to enable or disable the module and provided an explanation of the module and linked it to the official Apache documentation page. I gathered this information from the Apache documentation site and reformatted it to be easier to read and follow.