How to install Apache on Windows

This article explains how to install, configure and run Apache 2.0 under Microsoft Windows. Note! Running Apache on Windows 9x is not thoroughly tested, and it is never recommended on production systems.

Information on the latest versions of Apache can be found on the web site of the Apache web server at http://httpd.apache.org/download.cgi. There you will find the current release, as well as more recent alpha or beta test versions, and a list of HTTP and FTP mirrors from which you can download the Apache web server. Please use a mirror near to you for a fast and reliable download.

For Windows installations you should download the version of Apache for Windows with the .msi extension. This is a single Microsoft Installer file, which contains a ready-to-run version of Apache.

Run the Apache .msi file you downloaded above. The installation will ask you for these things:

  • Network Domain. Use localhost or 127.0.0.1 for your local installation.
  • Server Name. Use the same as above.
  • Administrator´s Email Address. Enter your desired email address here. This address will be displayed along with error messages to the client by default.
  • For whom to install Apache Select for All Users, on Port 80, as a Service – Recommended if you´d like your new Apache to listen at port 80 for incoming traffic. It will run as a service (that is, Apache will run even if no one is logged in on the server at the moment).
  • The installation type. Select Typical as this will cover most of your needs. A full install will require about 13 megabytes of free disk space. This does not include the size of your web site(s).
  • Where to install. The default path is C:\Program Files\Apache Group under which a directory called Apache2 will be created by default. I like to keep it seperate from basic apps since this will be my local web directory. Therefore I normally choose C:\Apache2 (Apache2 is created automatically, therefore just set C:\ as the install path).

During the installation, Apache will configure the files in the conf subdirectory to reflect the chosen installation directory. However, if any of the configuration files in this directory already exist, they will not be overwritten. Instead, the new copy of the corresponding file will be left with the extension .default. So, for example, if conf\httpd.conf already exists, it will be renamed as conf\httpd.conf.default. You can install Apache as a service automatically during the installation. Do that! After the installation you should manually check to see what new settings are in the .default file, and if necessary, update your existing configuration file.

Also, if you already have a file called htdocs\index.html, it will not be overwritten (and no index.html.default will be installed either). This means it should be safe to install Apache over an existing installation, although you would have to stop the existing running server before doing the installation, and then start the new one after the installation is finished.

After installing Apache, you can edit the configuration files in the conf subdirectory if required. These files will be configured during the installation so that Apache is ready to be run from the directory it was installed into, with the documents server from the subdirectory htdocs.

After starting Apache (either in a console window or as a service) it will be listening on port 80 (unless you changed the Listen directive in the configuration files or installed Apache only for the current user). To connect to the server and access the default page, launch a browser and enter this URL:

http://localhost/

Apache should respond with a welcome page and a link to the Apache manual. If nothing happens or you get an error, look in the error.log file in the logs subdirectory. If your host is not connected to the net, or if you have serious problems with your DNS (Domain Name Service) configuration, you may have to use this URL:

http://127.0.0.1/

Once your basic installation is working, you should configure it properly by editing the files in the conf subdirectory. Again, if you change the configuration of the Windows NT service for Apache, first attempt to start it from the command line to make sure that the service starts with no errors.

Because Apache cannot share the same port with another TCP/IP application, you may need to stop, uninstall or reconfigure certain other services before running Apache. These conflicting services include other WWW servers and some firewall implementations.

More information on how to edit the configuration files in the conf subdirectory will follow with related articles as how to install PHP5 and MySQL5 on Windows, and also how you create virtual web directories and aliases.

About Author

3 Comments on “How to install Apache on Windows”

Comments are closed.