DEV Community

Cover image for Install Apache on Windows in a Few Simple Steps
Techelopment
Techelopment

Posted on

Install Apache on Windows in a Few Simple Steps

The Apache Software Foundation offers open source software used around the world, with over 8,400 committers contributing to more than 320 active projects [https://apache.org/].

Why it's called "Apache"

Among all this open source software is the very popular Apache HTTP Server web server ๐Ÿ†’๐Ÿ†“๐ŸŒ

The Apache HTTP Server is an effort to develop and maintain an open source HTTP server for modern operating systems, including UNIX and Windows. The goal of this project is to provide a secure, efficient, and extensible server that provides HTTP services in sync with current HTTP standards [https://httpd.apache.org/].

In this article, we will see how to install it on Windows.

๐Ÿ”— Do you like Techelopment? Check out the site for all the details!

Distribution (download) Apache HTTP Server

The Apache HTTP Server project - or simply Apache - does not provide binary releases, only source code. This means that you will not find a file to download and install on the official website https://httpd.apache.org/.

You could compile Apache HTTP Server yourself on your PC, but if you are a Windows user, this approach is definitely not your first choice ๐Ÿ˜‚.

Fortunately, you can get a binary package from several distributions available on the Internet. The most popular options for distributing Apache HTTP Server - also known as httpd - and (optionally) server side scripting and databases on Windows are:

Installation with Apache Lounge

In this article, Apache Lounge was chosen for a simple and fast explanation.

1-Download the zip file from the "Download" section of the site https://www.apachelounge.com:

Apache Loungeโ€Š-โ€ŠDownload

2-Extract the file "httpd-2.4.62โ€“240904-win64-VS17.zip" (or "httpd-2.4.62โ€“240904-win32-VS17.zip" if you have Windows 32bit) with the "Extract all" feature already included in Windows. You can select the file and click on "Extract all" as shown in the figure or right-click on the file and the same option will appear in the context menu:

Extract all

3-Once the zip file is extracted, we will have the "Apache24" folder available which contains our Apache web server!

unzipped folder content

4-Move the "Apache24" folder (extracted from the zip file) under C: (do not rename the folder, it is a precious advice ๐Ÿ‘€)

Apache Configuration

1-Access the C:\Apache24\conf\ folder and open the httpd.conf file with a text editor. (e.g. Notepad)
2-Find the Listen 80 line and change 80 to 8081. It should look like this:

Listen 8081
Enter fullscreen mode Exit fullscreen mode

3-Find the line #ServerName www.example.com:80 and remove the # to uncomment it, changing www.example.com to localhost and 80 to 8081. It should look like this:

ServerName localhost:8081
Enter fullscreen mode Exit fullscreen mode

4-Let's save the httpd.conf file

Apache Execution

1-Open the prompt as Administrator: Win key type cmd choose "Run as Administrator":

prompt opening

2-Type the following commands to be able to access the bin folder:

cd \
cd Apache24
cd bin
Enter fullscreen mode Exit fullscreen mode

prompt to access bin folder

3-Run following command to install Apache as a service:

httpd -k install
Enter fullscreen mode Exit fullscreen mode

4-Let's check that there are no syntax errors in the httpd.conf configuration file (potentially introduced during Apache configuration). Let's run the command:

httpd -t
Enter fullscreen mode Exit fullscreen mode

If everything is OK, the message Syntax OK will appear.

5-Let's start Apache, always in the command prompt, we execute:

httpd -k start
Enter fullscreen mode Exit fullscreen mode

Verifying Installation

Open a browser and go to http://localhost:8081/. You should see the default Apache page, confirming that it is running:

it works

Stop or Restart

To stop or restart Apache you can use the following commands:

httpd -k restart

httpd -k stop
Enter fullscreen mode Exit fullscreen mode

Follow me #techelopment

Official site: www.techelopment.it
Medium: @techelopment
Dev.to: Techelopment
facebook: Techelopment
instagram: @techelopment
X: techelopment
telegram: @techelopment_channel
youtube: @techelopment
whatsapp: Techelopment


References

Top comments (0)