How to install Apache web server on Windows Cloud Servers

2020-06-16 By Ryan 9470 Views windows apache development
6 reviews

When considering website hosting in a Windows server, it is a must that the server has a web server installed it which listens for requests and returns data.

Some of the most common web servers available for Windows servers are Tomcat, Microsoft IIS (Internet Information Services) and Apache, which is one of the most widely used, fully-featured web servers available.


This guide outlines the basic steps required to install an Apache web server in a 64-bit Windows operating system.


Installing Visual C++ package

Before installing Apache, the latest Visual C++ package needs to be installed on the server. The latest package can be downloaded from the below link:

https://aka.ms/vs/16/release/VC_redist.x64.exe

Once the package has been installed, the server needs to be rebooted to ensure that any remaining changes which require a restart are completed.


Downloading Apache

The first step involved in the installation of the Apache web server in Windows is to download the pre-compiled Apache binaries for Windows. This is readily available in binary distribution websites such as Apache Lounge ( https://www.apachelounge.com ) and ApacheHaus ( https://www.apachehaus.com ).


In the context of this guide, the Apache binaries will be downloaded from Apache Lounge. The latest available Apache package will be available for download from the below link:

https://www.apachelounge.com/download/


Extracting the files

The Apache binary package will be downloaded as a ZIP archive. Extract the contents of the archive to the root of C: drive, to the folder named Apache24 (C:\Apache24).

windows22apache1


Testing Apache installation

  1. Open up the Windows command prompt as an Administrator user. For this, click on Start icon and type in cmd. Right-click on the Command Prompt option, and select Run as administrator.

    windows22apache2

  2. Change to the directory where the Apache binary files have been extracted C:\Apache24\bin.

    > cd C:\Apache24\bin
    

    windows22apache3

  3. Run the Apache program by typing in httpd.exe. If the cursor sits in the next line without any errors, it can be confirmed that the Apache server is working fine.

    > httpd.exe
    

    windows22apache4

    This can also be verified by accessing http://localhost in a browser inside the server. A page with the message It works! will be displayed which confirms that the Apache server is working.

    windows22apache5

  4. The Apache server can be shut down by pressing Ctrl+C in the command prompt.


Installing Apache as a system service

Once the Apache server has been confirmed to be working and shut down, Apache can now be installed as a system service. For this, follow the below steps.


  1. Open up the Windows command prompt as an Administrator user, change to the directory where the Apache binary files have been extracted C:\Apache24\bin and type in the below command.

    > cd C:\Apache24\bin
    
    > httpd.exe -k install -n "Apache HTTP Server"**
    

    The output of the above command will be as below:

    windows22apache6

  2. Type in the below command from the command prompt for opening Services setting.

    > services.msc
    

    The Services window will open up, where the Apache HTTP Server will be shown, with the Startup Type as Automatic. If it is not set as Automatic, do this by double-clicking on the service name.

    windows22apache7

  3. Restart the server once again, and once logged back in, the Apache service can be verified by accessing http://localhost in a browser inside the server. A page with the message It works! will be displayed which confirms that the Apache service has automatically started and is working.


Configuring Windows firewall to allow connections to Apache web server

In order to allow external connections to the newly installed Apache web service, a relevant Windows Firewall Rule needs to be configured. The below steps can be made use for this purpose.


  1. Click on Start icon, type in firewall and then click on the Windows Defender Firewall with Advanced Security option that shows up.

    windows22apache8

  2. Under Inbound Rules, click on New Rule… on the right-side panel.

    windows22apache9

  3. Select Port under Rule Type and click on Next.

    windows22apache10

  4. Under Protocol and Ports, select TCP for Does this rule apply to TCP or UDP?, select Specific local ports for Does this rule apply to all local ports or specific local ports? and type in the following to the input field: 80, 443, 8080.

    windows22apache11

  5. Click Next, and then select Allow the connection under Action.

    windows22apache12

  6. Click Next, under Profile, make sure that all check-boxes ( Domain, Private, Public ) are checked and then click on Next again.

    windows22apache13

  7. Type in a familiar name in the Name field, which will make it understandable that the rule is for allowing incoming Apache connections and then click on Finish.

    windows22apache14

  8. Once the inbound firewall rule has been created, try accessing the IP address of the server externally from any browser. The test page should show up confirming that the server now accepts incoming connections for Apache service.

    windows22apache15

    NOTE: Since the Apache test page can expose details about the server externally, it is recommended to disable the newly created firewall rule temporarily and enable it back once the original website is ready to be hosted on the Windows server.


Related Tutorials

What do you think about this article?

Rate this article
LayerStack Promotion
Need assistance?

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.