Do you want to check your new website’s ap­pear­ance without pub­lish­ing it? Or perhaps you want to test your self-pro­grammed scripts offline before they go live. A local test server is an in­dis­pens­able tool that allows users to do just that. With Windows, it’s quick and easy to set up an Apache HTTP server for free. In this detailed, step-by-step in­tro­duc­tion, we’ll show you how.

The Apache HTTP server at a glance

Apache is a free, open-source web server software, which was developed by the Apache Software Found­a­tion and is available free for the internet community. The programme generally listens to Port 80 to HTTP requests and provides HTML documents. Thanks to its modular structure, a wide range of functions can also be embedded. A com­bin­a­tion of databases such as MySQL and server-side script languages like PHP, Perl and Python are normally used to create dynamic pages. As the most popular web server in the world, the Apache HTTP server is part of a diverse software package, which also includes LAMP, MAMP, WAMP and XAMPP. In this tutorial, however, we will focus on how to install and configure the web server in single com­pon­ents.

In­stall­a­tion

All you need to get Apache on your Windows PC is the ap­pro­pri­ate Apache software package for your operating system. The Apache Software Found­a­tion only provides the source code on its website. You can also find ex­ecut­able binary files for Windows on community pages like Apache Lounge and Apache Haus. This tutorial is based on the Apache version 2.4.20 for 64-bit systems, which was obtained from Apache Lounge. To use Apache with a Windows operating system, no in­stall­a­tion is required; instead, you can proceed as follows:

  1. Save the software package in the form of a ZIP file in any folder on your local Windows PC.
  2. Unzip the ZIP file by double-clicking the folder icon.
  3. Name the file Apache24 and copy it into the C:\ file.

You will now be able to find all the files needed to operate your local Apache web server in the C:\Apache24 file.

Trial run

Following the in­stall­a­tion, it’s re­com­men­ded to conduct a trial run. To do this, first open C:/Apache24 and open the bin file. This is where you’ll find the httpd ap­plic­a­tion. Double click to start your Apache web server.

Your system will then normally display two error messages, in­dic­at­ing that software com­pon­ents must be installed and the Apache web server is being blocked by the operating system’s firewall.

The httpd.exe system error

If you are in­stalling Apache on your Windows PC for the first time, your system is likely to report that the VCRUNTIME140.dll file can’t be found and the web server therefore cannot be started.

These errors can be rectified by then in­stalling the required software com­pon­ents. Apache is written in C++, meaning the programme requires an ap­pro­pri­ate run time en­vir­on­ment when used on a Windows operating system. This is available through the compiler software Visual C++. Missing run time com­pon­ents can be installed with the Visual C++ Re­dis­trib­ut­able Packages. These are available to download for free from the Microsoft Website and can be installed by simply double clicking the .exe file.

Windows security warning

Generally, PCs are safe­guarded by a firewall, which prevents external pro­grammes gaining un­au­thor­ised access to a system via a network. If, however, you would like to make your local Apache HTTP server available on a home or work network, you need to ex­pli­citly authorise the com­mu­nic­a­tion with Apache. This can be done in the security message that follows, which reports that some of the web server’s functions are blocked by the Firewall.

If you wish to allow access to your server in one of the specified networks, check the cor­res­pond­ing box and click the ‘Allow access’ button. Ad­min­is­trat­ive rights are usually required in order to do this.

When you have installed the required run time com­pon­ents and adjusted the firewall settings to your par­tic­u­lar model, the use of an Apache HTTP server in its standard con­fig­ur­a­tion is no longer an obstacle. Restart the web server by double clicking the httpf file. A black command line window will open auto­mat­ic­ally. If you wish to end the Apache web server, close the window by clicking the ‘x’ in the upper right-hand corner.

To access your web server, simple enter ‘localhost’ or the standard IP address, ‘127.0.0.1’ into the search bar of any web browser. 

If all the settings have been correctly entered, the web browser will display a default index.html with the words, ‘It works!’ You can then configure your web server.

Con­fig­ur­a­tion

The Apache http server is generally pre­con­figured as a software package in such a way that makes it still func­tion­al without any further settings. All content that is to be accessed via a web server will be saved in a folder called ‘Doc­u­ment­Root’ in the httpd.conf con­fig­ur­a­tion file. By default, this is the htdocs folder at C:\Apache24.

If you wish to save your website‘s documents and files in another folder, it must be entered in the httpd.conf as ‘Doc­u­ment­Root’ and ‘Directory’.

For this demon­stra­tion, we’ve created a new folder called ‘My­Homepage’ in the C:\ file. This is acting as a webpage folder for a fictional website. Two HTML documents: test-1 and test-2 have been saved in this file.

Now we adapt the in­form­a­tion for ‘Doc­u­ment­Root’ and ‘Directory’ for our new website folder by replacing both instances of ‘C:/Apache24/htdocs’ with ‘C:/My­Homepage’.

To access the web server, the Apache must first be restarted via localhost. The web browser will then display the website folder’s index with the HTML pages, test-1.html, and test-2.html.

Go to Main Menu