Install Apache on Windows 10 WSL – HTTP Web Server
You can install Apache on Windows 10 very easily it is no longer a task of Sisyphus, you do not need to go through several documentations to understand how to configure it and adapt it to its use. As we know, Apache HTTP web server is part of Linux and usually works in LAMP (Linux, Apache, MySQL, PHP) environment to support any web application. So on the desktop or Windows server you are definitely not just looking for the Apache install, maybe the whole LAMP stack. Therefore, it could be a very tedious job to install every part of LAMP on a system that is primarily not intended for this. The other remaining options are XAMPP or WAMPServer, however, they are not meant to work for just any production environment and sometimes also perform less well. In such a situation, WSL (Windows Subsystem for Linux) is a godsend on Microsoft Windows 10 and Windows 2016 servers.
You can use some Linux servers such as Ubuntu 18.04 or Centos 7 on the Windows Subsystem for Linux to install Apache with Mysql and PHP to achieve the same level of performance as you, except on some native Linux servers or desktops.
Also, with the announcement of WSL 2 (Windows Linux Subsystem Second Release) in which Microsoft has integrated a full-fledged Linux kernel for WSL, it is 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 yet enabled WSL, just search for “Enable or disable Windows functionality“in the Windows search box and open it. Hence select the Windows Subsystem for Linux to activate it. For more information on this, see our article: Activate WSL on Windows 10 or Server.
Step 2: Download Ubuntu or Centos for WSL
To install Apache on Windows WSL, we must first activate the Windows Subsystem for Linux, which we have already done in the first step of this article. Now it’s time to install a Linux distro on it. If you want to use Ubuntu 18.04, just 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 it: Centos 7 Linux on Windows Subsystem for Linux.
Step 3: Launch the Linux operating system on Windows WSL
After installing Search and opening Ubuntu, it will take some time to prepare. Once it does, a command terminal window will appear and then proceed to the next step.
To note: The WSL does not support the graphical user interface by default, however, it is good to easily access and install Linux applications on it.
Step 4: Install Apache on Windows 10 Subsystem for Linux
Now from there everything is the same as installing an Apache web server on a Linux operating system. Type the command below in the Windows 10 WSL command terminal.
sudo apt-get install apache2
sudo yum install -y httpd
Step 5: Activate the Apache service on Windows
After our Apache-based web server is installed on Windows 10 WSL, it’s time to activate its services, otherwise it won’t work at all. To start the HTTP services, use the command below:
sudo service apache2 start
sudo service httpd start
Step 5: Whether or not to test the Windows Apache web server
The installation of Apache HTTP web server on Windows 10 or 2016 servers is finally finished, it’s time to check if it is working or not. To do this, simply open your system browser and type http://127.0.0.1:80.
This way you can also install Mysql and PHP + PHPMyAdmin to test other Linux web applications on Windows using LAMP stack.