Why on earth can I not configure my Apache web server that is part of my WAMP stack to listen on port 80? I guess this would make sense, if I would have installed Internet Information Services IIS. However, I would not expect on a normal Windows 10 client port 80 to be in use. Still, it is and for a number of reasons I couldn’t just go with the normal resolution for this problem and configure the Apache web server to listen on another port instead and use for example port 8080. If this would work for you, then you can just click the WAMP icon in your task bar, highlight Apache and finally click httpd.conf. Search for “listen” and you’ll probably find the following lines
listen 0.0.0.0:80 listen [::0]:80
So the quick fix would be to change these lines so that Apache would listen on port 8080 both for IPv4 (first line) and IPv6 (second line).
listen 0.0.0.0:8080 listen [::0]:8080
But as I said: I needed Apache to listen on port 80. So first I needed to understand what process on my computer was using port 80.
netstat -aon | findstr :80
That gave me the PID (in my case 4) of a windows service that I then could identify using Window’s Task Manager as “ntoskrnl.exe”. To cut a long story short: There is indeed a windows service that listens on port 80 for a number of good reasons that go beyond this quick post. But I found this post that explained how I could have these services only list on port 80 using IPv6 and by doing so this would free up port 80 on my Windows 10 client.
netsh http add iplisten ipaddress=::
I don’t know all side effects yet, but my computer continues to run normally and I could now configure Apache to listen on IPv4 port 80 by changing the http.confd as follows:
Yes: I needed to use 127.0.0.1 because “localhost” from now on refers to “[::0]:80”. So yes, there is at least one side effect. I resolved this by changing the windows hosts file located in C:\windows\system32\drivers\etc as follows:
127.0.0.1 local ::1 localhost