Installing Apache 2.2.x web server on Windows

December 16, 2008

This short tutorial explains how to install Apache 2.2.x on any computer running Windows.

Apache web server is the number one web server in use today used for both large and small sites. Apache is used for large commercial sites as well as smaller sites. Apache is free, and available for nearly every operating system. Having your own apache server is a great way to test your sites without having to constantly upload to a web host.

First, download the installer from The Apache foundation website: http://httpd.apache.org/download.cgi. Scroll down to the section that reads Apache HTTP Server 2.2.x. Look for the two lines that begin with Win32 Binary.

apache-download-link

The mod_ssl option is for users that plan to use SSL, also known as a secure server. This is when users see a padlock symbol when browsing a site. If you plan to add a secure server in the future, download the link with OpenSSL. If you just plan on setting up a normal server then either download will work.

apache-install-intro

After downloading the installer, run it. A welcome dialog will appear, click next.

Accept the license agreement.

Next, a dialog with some general information will appear. Read the info and click next .

After reading the information, a dialog will appear for entering the domain information. If you don’t have a domain, just enter localhost for Network domain and Server name. The first box is the domain name which is the domain with no subdomains (ex: google.com and not www.google.com)

Enter your email address for the Administrator’s email. The Administrator’s email is the contact address that appears when a user comes to an error page (such as a 404 – Not found).

Choose whether to install for All users as a service, or just for the current user. The difference is that a service will always be running even if no one is logged on (if Windows is sitting at the login screen for example). The reason it runs on port 8080 for the current user is that Windows restricts access to ports below 1024 and this is suitable for users who do not have Administrator access.

apache-server-domain-information

A dialog prompting for a typical or custom installation will appear. For this tutorial we will select the typical installation. The custom installation will allow you to pick exactly what files you want to install.

Next, a dialog prompting the user to choose the installation directory. Use the default or browse to choose a different directory and click next.

Now that everything is ready, click Install.

apache-install-copying

After installing, if you have some type of Antivirus or firewall software installed you may be prompted to allow Apache to listen on a port. Allow the application to use this port.

firewall-warning

If the domain name you entered near the beginning does not resolve to the computer you’re installing on, you may get a console error that looks something like this:

Installing the Apache2.2 service
The Apache2.2 service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
httpd.exe: Could not reliably determine the server's fully qualified domain name, using 192.168.1.111 for ServerName

This is okay, it just means that whatever you entered as the domain does not yet point to the computer you are installing Apache on. If you want to test your server using your real website’s address but don’t want to point your DNS information to your test server you can use Windows’ hosts resolution file to point your domain to your test server for only your computer.

Click finish, now we are all done installing Apache.

Now, to start adding files to your website, navigate to Apache’s installation directory (ex: C:\Program Files\Apache Software Foundation\Apache2.2). This is where all Apache’s important files are inlcuding the document root. The document root is the location of the files you see when you visit your site in a browser.

Your document root folder is named htdocs, double click on that folder. Go ahead and start copying your site’s files into this folder and they will instantly be on your website.

apache-document-root

Also, notice the new icon in the system tray. Click on this to start, stop, and restart your web server.

apache-server-icon

If for some reason you can’t use the system tray icon to start and stop your server, you can use the service manager in the administrative area of your control panel.

Classic View Control panel > Administrative Tools > Services
Category View Control Panel > Performance and Maintenance > Administrative Tools > Services

apache-service-admin

Right click on the Apache 2.2 service to start or stop the server.

Now, make sure your web server is started and navigate your browser to http://localhost

apache-success-page

You should see whatever files you copied into your document root folder, or the default Apache “It works” page.

Conclusion and further reading

Apache allows you to have multiple sites running from a single server. You can also configure scripting languages, site behavior, and document root directories just to name a few. For more information, visit our Configuring Apache 2.2.x on Windows section.

del.icio.us Digg Facebook Google reddit SlashDot StumbleUpon Technorati

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Comments are closed.