First of all, the way http.sys works on newer Windows versions is a very useful feature. The reason behind http.sys is to have a single system service that listens on the all-important port 80 and be a mediator to different applications and services in the system that might like to handle incoming requests on port 80 but for different urls. What an integrated Windows application does, is use a Windows API for registering its own urls and then have them directed to itself. At the same time, there can be other applications also getting incoming requests to port 80 but for different registered urls.
The problem is that some (many?) open source project that have been compiled for Windows, does not use this http.sys API. Therefore, when they start up and try to bind to port 80, they will fail since it is occupied by http.sys. And I have to admit that I have no idea how easy or hard it would be to patch such a project to make that call on Windows and get the tcp/ip network stack to work with it.
Examples of such projects are:
(Haven’t looked at how nodejs does it.)
Some solutions I’ve found suggests disabling http.sys, but that only works if you are sure you won’t have any use for Windows applications that do know about http.sys. I didn’t want to do that.
My suggested solution is instead to tell http.sys to bind to a specific ip-address, and then use any other ip-addresses on your system for Nginx (or whatever you are looking to install). It turns out this is possible via the netsh command line configuration tool in Windows (from version 7 anyway).
So, one way would be to add an extra ip address to your network configuration. But I chose instead to use the fact that every system nowadays has both an ipv4 and an ipv6 address. My solution is to bind http.sys to the ipv6 general address (named “::”) and thereby free up the local general ipv4 address (named “127.0.0.1″) for my Nginx server.
Telling http.sys to bind to the ipv6 general address is easy. Just run the follow command from a command prompt window as Administrator:
netsh http add iplisten ipaddress=::
It seems that the name “localhost” binds to the ipv6 address, actually “::1″, so from now on you can still get the http.sys applications and services via “http://localhost”. And if you install and run Nginx on port 80 it should start fine and be available at “http://127.0.0.1″. Or you could even edit your “C:\Windows\System32\drivers\etc\hosts” file and add the line:
Now having “localhost” for ipv6/http.sys and “local” for ipv4/Nginx.