You can install Apache on Windows 10 very easily it is not a Sisyphean task anymore, you don’t need to need to go through multiple documentations to understand how to configure and up it to work with. As we know the Apache HTTP web server is part of Linux and work generally in LAMP (Linux, Apache, MySQL, PHP) environment to support any web application. Thus, on Windows Desktop or server, definitely, you are not looking for solely Apache installation, perhaps whole LAMP stack. Hence, it could be a very tedious job to install each part of LAMP on a system which is primarily not meant for it. Other options that left are XAMPP or WAMPServer, however, they are not meant to work for any production environment and also some times not so much performative. In such situation, WSL (Windows subsystem for Linux) is a boon on Microsoft Windows 10 and Windows 2016 servers.
You can use some Linux server such as Ubuntu 18.04 or Centos 7 on Windows subsystem for Linux to install Apache along with Mysql and PHP to get the same degree of performance as you except on some native Linux server or Desktop.
Moreover, with the announcement of WSL 2 (Windows subsystem Linux second version) in which Microsoft has integrated full-fledged Linux kernel for WSL makes it better than before. Let’s see how to do this…
Install Apache HTTP web server on Windows 10 -WSL
Step 1: Enable WSL on Windows 10 or 2016 server
If you haven’t enabled the WSL yet, then simply search for “Turn Windows feature on or off” in the Windows search box and open it. From where select Windows subsystem for Linux to enable it. For more info on it, see our article: Enable WSL on Windows 10 or server.
Step 2: Download Ubuntu or Centos for WSL
To install Apache on Windows WSL we have to first enable the Windows subsystem for Linux which we already did in the first step of this article. Now, its time to install some Linux distro over it. If you want to use Ubuntu 18.04 then simply open the Microsoft Store and search for Ubuntu. When it appears, install it.
Currently, Centos 7 is not available on Windows store and to install it we have to download it manually. Here you can see how to do that: Centos 7 Linux on Windows Subsystem for Linux.
Step 3: Launch Linux OS on Windows WSL
After installing search and open Ubuntu, it will take some time to get ready. Once it is, a Command terminal window will appear and then move to the next step.
Note: The WSL doesn’t support graphical user interface by default, however, it is good to easily access and install Linux apps over it.
Step 4: Install Apache on Windows 10 subsystem for Linux
Now from here, everything is same as installing Apache web server on some Linux operating system. Type the below-given command in Windows 10 WSL command Terminal.
sudo apt-get install apache2
sudo yum install -y httpd
Step 5: Enable Apache service on Windows
Once the Web server of our based on Apache installed on Windows 10 WSL, its time to enable its services other it won’t work at all. For starting the HTTP Services use below command:
sudo service apache2 start
sudo service httpd start
Step 5: Test Windows Apache web server is running or not
The install of Apache HTTP web server on Windows 10 or 2016 servers is finally completed, its time to check whether it is working or not. For that simply open your system’s browser and type http://127.0.0.1:80.
In this way, you can install Mysql and PHP + PHPMyAdmin too for testing other Linux web applications on Windows using LAMP stack.