How to Install Apache HTTP Server on Windows
In this tutorial, we will demonstrate how to install Apache server on a Windows PC in order to build a local server environment.
Also See: Apache vs. Apache Lounge
Apache is a highly popular open source web server software which is used on millions of hosting servers and websites around the world. As an open source software, Apache is free to download and install on your computer or server. It is one of the web tools that is required on a machine (computer, server, etc.) to make it work like a web server so that it will allow the publishing of documents and websites on the web.
Since I am not an Apache expert, I will not go into all the details about what Apache is and what it is capable of; besides, it is not the topic of this post. I will keep this introduction part short and continue with the Apache installation steps. If you want to learn more about Apache web server, visit the official site here: http://httpd.apache.org/.
The reason for me to compile this tutorial about how to install Apache on your computer is that when I decided to install it, I couldn't find many good resources that take you through each step in detail and tell you which versions of Apache and PHP you should download and install. Before we start with the installation steps, let me make some points clear, so that you will have a better understanding of Apache server.
Why You Should Install Apache?
I am working on Windows Vista operating system on my laptop and recently, I decided to build my own local server and learn PHP and MySQL programming so that I could create my own custom coded websites like this one.
PHP is a server side scripting language (see how PHP works), therefore it will not work on a computer unless a web server software like Apache is installed. Apache (or any other web server software) is required to serve content on the World Wide Web. Websites, web pages, files and documents can be made available to everyone that has an Internet connection with the help of a web server software. Also, if you have Apache installed on your computer, you can host your own websites as well, though this is the topic of another post. Installing Apache server on your local machine is a very good idea if you are a web designer/developer, since you will need to test your design work and scripts a lot of times before publishing them on the actual server.
Which Apache Version to Download: 1.3 or 2.2?
Version 1.3 is no longer officially maintained and therefore if you run into a problem, it will be difficult to find help about that version. You shouldn't install 1.3 unless you need to do so, specifically. So, if you don't need to work on version 1.3, download and install Version 2.2. Version 2.3 is still in beta version and you really needn't worry about it at this stage.
Do You Need SSL?
SSL (Secure Socket Layer) is a way of adding encryption between the server and the website visitor. You will notice an "s" letter on the websites that use SSL, such as https://website.com/. If you want to add SSL function to your website, then you need to download the version that includes mod_ssl.
Apache - PHP Compatibility
Official Apache Windows installation package is a VC6 build to be used with the VC6 builds of PHP. The official Apache VC6 package works nice with the aging NT4 right up to all present versions of Microsoft Operating Systems. If you want to work with the official Apache build, the latest version of PHP you would install would be PHP 5.3.5 (VC6) which you can find on the php.net archives. There are currently no official (32bit / 64bit) VC9 compiled Apache packages to suit Microsoft Windows. Though, if you want to work with the latest stable PHP version, 5.3.8 (VC9), you will need to download the unofficial VC9 build of Apache from Apache Lounge:
You can also learn more about this issue on the official PHP download page. Now, let's continue with downloading the official Apache build.
Download Apache Server
Go to http://httpd.apache.org/download.cgi#apache22 for the latest best available Apache Version (2.2.21 at the time of writing this post). Locate and download the following package:
Win32 Binary without crypto (no mod_ssl) (MSI Installer): httpd-2.2.21-win32-x86-no_ssl.msi
Install Apache Server
Once you downloaded Apache, run the file so that it will start the installation. You will see a "Welcome" screen, click Next. On the second window, you will see the License Agreement; read it, accept it and click Next. On the Server Information window, enter localhost into the Network Domain and Server Name fields. Enter your email address in the Administrator's Email Address field. Depending on who will access the server, select one of the radio buttons. It is recommended to install Apache HTTP Server for all users, on Port 80, as a Service. The other option will allow only you to access the server. Also, note that if you choose the second option (Port 8080), you will need to add 8080 on the localhost addresses like http://localhost:8080/index.php.
On the next window, choose either Typical or Custom as the setup type. If you choose Custom, you can select the features you want to be installed or not. You can also add or remove features at a later time by starting this installation file again. Click Next and then Install.
When the Apache Server is installed, you should see its icon on the system tray like the below image shows.
If you cannot see Apache system tray icon, you can go to C:\Apache2\bin folder and double click ApacheMonitor.exe so that the icon will be visible again.
Testing Apache Installation
The first thing to do after the installation is to check whether the Apache server is successfully installed and running. To do that, you can simply open a browser and type in either of the following addresses into the address bar:
You will get "It Works!" message if everything is fine. If http://localhost doesn't work, you can check your hosts file (this file has no extension) by going to C:\WINDOWS\system32\drivers\etc and opening the hosts file with notepad. If the following line is missing, add it and save the file.
Re-start Apache and you should be fine. You can restart Apache server by right clicking on its icon on the system tray. If restart option doesn't work, try stopping and then starting.
Apache Home Directory
In a standard installation, Apache's root directory will be located at:
But this may be different on your system. The only thing you should know is that the root folder is the htdocs folder within Apache folder. htdocs will act like the root directory of your web host and its content will be accessible through http://localhost/. This is the folder where you will place your web pages like index.html etc. You can also place folders (possibly for multiple website projects) into the htdocs folder and access them through localhost.
If you have followed all the steps up to now, you should have your Apache server up and running smoothly. Don't forget to restart Apache server after any configuration changes.
This is how Apache is installed on Windows Vista, I guess it will be more or less the same on Windows XP and Windows 7 as well. Please let me know if you have any questions. Thanks for reading.
More Server Tips
How to Install Apache HTTP Server on Windows: The Apache Lounge Version How to Download the .ftpquota File What is the Use of .ftpquota File? How to Prevent Search Engines from Indexing Your Web Pages and Files What is the Difference Between public_html vs. www Folders? Apache vs. Apache Lounge: Which One to Choose? How to Set FTP Quota for an FTP Account Apache Localhost Loading Very Slow: Here is the Solution List of All HTTP Status Codes and Error Messages Top 5 Free IP Address Lookup SitesServer Tips