How to Install Apache Web Server on Windows

how to install apache web server on windows

Windows Server 2022 is made by a variety of capabilities and roles that permit its users to manage secure workloads, support innovative hybrid cloud scenarios and upgrade their apps to meet changing business environments. There are many additional useful features that can be incorporated into the server with the installation of Apache Web Server. When you install the Apache web server on Windows, it opens the possibility of setting up an open-source HTTP server so that clients are able to host and manage their apps.

In this article, we’ll go over the steps you must complete on how to install Apache on Windows.

 

Step 1: Download Apache Files for Windows

The initial step in installing Apache Web Server on Windows is really similar to when you install Apache on Windows 10. The packages are available for free through Apache server download for the Windows website.

Apache can be downloaded with both 32-bit (x86) as well as 64-bit (x64) versions based on the version on your Windows Server. This guide will move ahead in this article based on the assumption that your Windows server runs an operating system with 64 bits.

Therefore, we need to download Apache 2.4.52 Win64 to install Apache web server on Windows.

Furthermore, ApacheLounge also mentions that you must also have the correct CRedistributable to Visual Studio in your system. Make sure to download the most recent version of 14.30.30704 Visual C++, Redistributable to Visual Studio 2015.2022.

The chances are that you have already installed it on your computer. If you don’t, then download and execute “vc_redist_x64.exe” (for an operating system with a 64-bit operating system) as well as “vc_redist_86.exe” (for a 32-bit system) on the ApacheLounge site.

 

Buy Windows VPS Hosting

 

Step 2: Unzip the Apache Files

When the zip file is downloaded, copy its contents and save them to the appropriate place to install the Apache web server on Microsoft Windows. To install Apache for Windows 10 or any other version, it is advised to save the files in the C: drive of your server.

Step 3: Configure Apache

The following step for installing Apache Web Server on Windows 2022 is to configure Apache to be installed at the same location from which you’ve extracted the file.

Navigate to go to the “conf” subdirectory, and then locate the “httpd.conf” file. The configuration file assumes you have taken a copy of Apache from C:/Apache24 in default. If, however, you’ve extracted Apache in a different folder (i.e., F:/Apache), You will need to modify it in the configuration file, too. To do this, you have to change the $SRVROOT variable of the “httpd.conf” file to refer to the directory you’ve selected.

Hence, Change Define SRVROOT “C:/Apache24” to Define SRVROOT “F:/Apache”

If you don’t see the location of the variable within the “httpd.conf” file, the directory could have been referenced separately for each time. In this scenario, you’ll need to change the variables manually for all instances that are “C:/Apache24”. Therefore:

1- Change ServerRoot “C:/Apache24” to ServerRoot “F:/Apache”

2- Change DocumentRoot “C:/Apache24/htdocs” to DocumentRoot “F:/Apache/htdocs”

3- Change ScriptAlias /cgi-bin/”C:/Apache24/cgi-bin/” to ScriptAlias /cgi-bin/”F:/Apache/cgi-bin/”

 

Furthermore, you must make different modifications no matter where you take Apache files. They include:

Add “ExecCGI” into the “Options” directive:

Locate the “Options Indexes FollowSymLinks” and then add “ExecCGI” to it:

Allow the Execution of .cgi/.pl Files:

This basically allows for the use of CGI/Perl scripts in addition to the directory cgi-bin.

 

Locate the next line within the configuration file. remove the # symbol.

AddHandler cgi-script .cgi

 

In addition, you can add the following lines below:

AddHandler cgi-script .pl

These two lines instruct Apache to run the .cgi/.pl documents instead of showing the text files to an internet browser.

Find the location of Perl directly from Windows Registry

The following line should be added to the very end of your configuration file

ScriptInterpreterSource Registry

The initial line in .cgi/.pl files directs Apache to the location of the installation of Perl. The addition of this line enables Apache to skip the second line and find the place of Perl directly using the Windows Registry.

 

Step 4: How to Start Apache on Windows 11

Start a Command Prompt or PowerShell in the “bin” directory at the place where you have extracted Apache. Right-click and hold “Shift” and select “Open command window here” or “Open PowerShell window here”.

For the Command prompt, use the following command to begin Apache:

Httpd.exe

For PowerShell, use the following command in order to start Apache:

& “D:\Apache\bin\httpd.exe”

There could be the Windows Firewall prompt. Let the access be adequate. If you don’t permit Apache access via your firewall on your server could lead to other devices/computers being unable to connect to your website server. When you buy Windows VPS hosting, there are firewall configurations in place. There will be a “could not bind to address” error when a different service is operating on the default port of Apache (80).

Also, ensure that you do not have any IIS (Internet Information Services) server that is operating. If you do, you must shut down or disable IIS so that you can use Apache or alter the port for the other IIS or Apache in order to permit both services to operate simultaneously. Consult the manual of the vendor to learn more about how you can change servers listening ports.

Step 5: Apache is Running Successfully

Ensure the command window you were using is open, and browse to http://127.0.0.1 via your internet browser. In the event that Apache has been running in your Windows Server 2022, you’ll see the text “It works!” within your browser.

Step 6: Install Apache as an option for a Windows Service

In the following step, Apache will exit after closing the PowerShell or command prompt. Now, when you buy Windows VPS hosting and install the Apache web server on Windows, you would want to have it running 24/7; In order to ensure that the Apache web server is running 24/7, you must set it up in the form it is a Windows service. This is the way you can set up Apache as a Windows Service in an easy and speedy manner:

Step 1

Start the command prompt for administrative use and then type the command below:

Httpd.exe –k install –n “Apache HTTP Server.”

Step 2

Write the following command, and then press ‘ Enter’ within the Command Prompt window.

Services.msc

Find the server “Apache HTTP Server.” It should show “Automatic” on the left side of the line. If not, you can change the startup type in the form of “Automatic” by double-clicking it.

Step 3

Restart your server, and then open an internet browser when you’ve logged back in. Go to this URL in your web browser: http://127.0.0.1

Step 7: Configure Windows Firewall

Setting up your Windows Firewall is the last step before you install Apache on Windows 10 or 2022. It permits connections to the Internet to the new server. Below are the steps required to follow.

Step 1

Go to the Start Menu and enter a search “firewall”. Click on the “Windows Firewall with Advanced Security”.

Step 2

Click on “New Rule” in the left-hand sidebar.

Step 3

Select “Port” and then select Next. Select the radio button beside “Specific remote ports:” Enter the following in the box for input: 80, 443, 8080.

Step 4

Click Next, then choose the “Allow the connection” option.

Step 5

Click “Next”. Be sure all boxes in the next screen are checked, and click Next.

Step 6

Within the “name” section and write a short description that assures you that you’ll be able to recall what the rule’s goal is later on, for example: “Allow Traffic.”

Step 7

Click “Finish”.

Step 8

Test your server on different devices by connecting to the server’s IP address using an alternative device to the device you’re connected to the server now. Open a web browser on that device and enter the IP address of your server like http://84.656.487.10

You’ll be able to access the test website page, which shows “It works!”.

If your test page functions with no issues and displays the correct message, you’ve successfully set up Windows Firewall, and other devices can connect to your server. Now you know after you buy Windows VPS hosting how to start Apache on Windows 11 and install it as well!

 

Buy Windows VPS Hosting

 

Conclusion

Installation of Apache Web Server on Windows may be an intimidating undertaking at first. But when you follow the step-by-step instructions that are provided in this post, this can turn simple. After installing Apache to your Windows server, you will be able to make a web development environment in order to develop and test your site.

Whether you’re a web developer or simply trying to set up your own website server, Apache can be regarded as a dependable and well-known web server program that will satisfy your requirements. By using the information you’ve gained through this tutorial, it is easy to set up and install Apache for your Windows machine and begin building and testing web-based applications.

Leave a Reply

Your email address will not be published.