Installing Apache Server on WSL 2

Installation on WSL2

ports confilict happen on host operating system i means windows 10 when the service on wsl is accessed with localhost but if we use hostname the ports that are in use on windows 10 will not conflict with the service running in wsl 2

hostname -I

hostname changes every restart of system

use this ip address to access the services on host machine

for public address curl -4

Side Note

Instead of using sudo systemctl start docker use: sudo /etc/init.d/docker start , as of right now we do not have systemd in WSL 2.

sudo apt update sudo apt install certbot sudo apt install apache2 service apache2 status

Opening HTTP and HTTPs Ports

Include all the user configurations:

Include /etc/apache2/httpd.conf

Installing Apache on Windows