Windows Subsystem for Linux is a great tool for Web Developers using the Windows operating system. With the release of WSL2 which brought the introduction of a real Linux Kernal, the environment saw huge speed improvements, cementing itself as the preferred development environment for many developers. However, some Windows updates have proven to cause problems with software installed on WSL. In this post, we are going to walk through the steps to solve “Apache2 startup failed: Permission denied in WSL”.
Apache2 startup failed: Permission denied
(13)Permission denied: AH00072: make_sock: could not bind to address [::]:80 (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
What causes a permission denied error?
Apache listens on port 80 for HTTP connections and 443 for HTTPS connections. The error above occurs when another service is already listening on these ports. In this case, after a Windows update, the IIS (Internet Information Services) service started up, listening on port 80.
Solve Apache2 startup failed error
To fix the issue, we need to stop the IIS service.
Search and open ‘Services’ in the Windows start menu
Find and select ‘World Wide Web Publishing Service’. This service provides web connectivity and administration through the IIS manager.
Right-click and hit stop. This will only stop the service until your restart your machine.
Check the startup type is of the service. This is probably set to Automatic. You may want to simply stop the service for now, but it may cause more issues in the future, so it’s best to disable the service from starting up again.
If you use IIS alongside your WSL Apache2 service, you may want to start the service up again when you require it.
To disable the service from starting automatically, right-click and select properties. This will open an additional popup.
Find startup type and set the field to Disabled. Then apply the changes.
Open a terminal, and start the Apache2 service.
sudo serivce apache2 start
Apache 2 should now start as expected.