technology:
Installation of Apache 2.2 on Windows is almost the same for all versions of Windows. This example shows Windows XP.
Apache 2.2 has few improvements over Apache 2.0 that are relevant to Web site developers. The installation has slight improvements. The main advantage of XP 64, as used in this example, is the ability to install in the administrator login while running programs in your regular login.
Download the latest stable Apache 2
The downloads are listed on httpd.apache.org. I used 2.2.15.
You can download Win32 Binary without crypto (no mod_ssl) (MSI Installer) or Win32 Binary including OpenSSL 0.9.8m (MSI Installer). You want the second one with both SSL and the MSI installer. The download is a trivial 6 megabytes.
Windows security warning
Windows XP warns you about so many trivial and irrelevant things that it is surprising to see a useful warning about installing software from untrusted sources. If only Microsoft would warn you about installing their major viruses, Internet Explorer, File Indexing, and Outlook Express.
Select run at the following message.

Welcome
There is not much of interest in the following welcome screen. Select Next.

License agreement
Select I accept then Next.

Do not bother reading this
The following screen is labelled Read this first and contains only information you already know from the Apache Web site. Select Next.

Test server name
The following screen requires a domain name, server name, and email address. Use your domain name to replace example.com. Name your local test server test or local. Then select Next.

Custom setup
In the following screen you can use the default typical installation or select Custom to see all the options available to you. Select Custom then Next.

Custom selection
The following screen shows all the items installed by the default setup and lets you customise the list. I usually leave out the documentation and the taskbar icon. You can log in as administrator then select the taskbar icon actions from the regular menu under Apache without taking up screen space for an icon. The documentation is online with an entry in the menu under Apache.

Ready to install
The following Ready to install program screen does not provide any useful information. Select Install.

Finish
Select Finish at the following screen.

Test Apache
127.0.0.1 is always the IP address of your own computer. You can visit http://127.0.0.1/ to test Apache. You will see a page saying It works! If you installed the Apache documentation, you would see a formatted page with links to the static local documentation.
You can also visit localhost to test Apache because localhost is defined as a name for 127.0.0.1.
Hosts
Edit the file named c:\windows\system32\drivers\etc\hosts. Notepad is fine for the edit. You do not need a fancy editor. You will see the following line defining localhost as a host name for IP address 127.0.0.1.127.0.0.1 localhost
Add the following line and save the change.127.0.0.1 text.example.com
Visit test.example.com to test your change.
You can see that a local site needs an entry in hosts. Windows looks in hosts before looking out on the Internet. The entry in hosts links the site name to the local IP address.
Edit the configuration file
You now have an entry in the menu for Apache. There is a submenu titled Configure Apache Server containing two entries, Edit the httpd.conf file, and Test configuration. You edit the httpd.conf file to add Web sites. There are tutorial online about how to add a Web site. You need only a small amount number of settings to create a working Web site.
The following quick example shows a Web site named test.example.com defined on drive h in directory /home/. You have to create the directories before Apache starts. Apache will create the log files when it starts.<VirtualHost test.example.com>
ServerAdmin webmaster@example.com
DocumentRoot "h:/home/test.example.com/public_html"
ServerName test.example.com
ErrorLog "h:/home/test.example.com/logs/error.log"
CustomLog "h:/home/test.example.com/logs/access.log" common
</VirtualHost>
<Directory "h:/home/test.example.com/public_html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
In the quick example, I created the directories using a structure similar to a Debian based Web server because I use Debian based Web servers. You can create any directory structure that is useful to you.
Creating an entry for a Web site is beyond the scope of this page. The Apache documentation is almost useless for a beginner because it is a reference, not a tutorial. You could look in the Apache documentation to decode the example but you will eventually need a good tutorial to take you through all the options for defining multiple Web sites.
Test your Web site
127.0.0.1 will take you to your local Apache server and the Apache default. You can replace the default with your test server. When you have several test sites, you want to access them by name. When you develop a new site for example.com, you can create a local test.example.com then t2.example.com and any other combination you like.
You can test static HTML sites at this stage. After you install PHP, you can create dynamic pages. Test PHP before moving on. A useful test is to download and install PHPMyAdmin then test the display of the main PHPMyAdmin page.
When you have PHP and MySQL installed, you can create dynamic sites. The best test is to download and install PHPMyAdmin then test your access to MySQL databases through PHPMyAdmin.
The next step is to install Drupal so you can create top quality dynamic sites with very little or no coding.
Conclusion
Installing and testing Apache on Windows is easy. Changing the hosts file is easy. Configuring a new site in Apache requires additional reading and is the most difficult bit. After you get the first site working, the others are just a one minute copy, paste, and edit.









- Facebook Like
- Google Plus One
- Log in or register to post comments