Thought Patterns

Cameron’s thoughts on everything and nothing.

Getting Apache to run on port 80 on Windows 7

| 180 Comments

Update

This solution is no longer necessary. It turns out a service called BranchCache is the culprit. Disabling this service stops Windows from listening on port 80 thus allowing you to run a web server. The description for BranchCache under services.exe is ‘This service caches network content from peers on the local subnet.’

Thanks to a fellow beta tester for the latest resolution.

I’m currently beta testing the next version of Windows, Windows 7 and came across a strange issue while trying to get Apache to install and run using the default port, 80.

Running the command ‘netstat -ano’ from the command line revealed
that port 80 is being used by PID 4.

Looking up PID 4 using Power Shell and then Task Manager revealed
that PID 4 is the NT Kernel!

So Windows 7 by default appears  to be using port 80.

After a bit of hunting around the Internet and doing some research of my own I found that the service http.sys was the culprit and all I needed to do was disable it but I could not find this service listed in the Services control panel applet.

So what’s the solution?

You have to disable the http.sys service manually via the registry:

1) Launch RegEdit:

2) Go to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP

3) Add a new DWORD (32-bit) value

4) Name it ‘NoRun’ not including the quotes

5) Double click the new property

6) In the Value data field type ’1′ not including quotes and click OK

7) Re-boot your computer

You should now find that Apache will start on port 80!

Bookmark and Share

180 Comments

  1. I tried installed XAMPP in my Windows 8, I ran CMD with “run as Administrator”, then executed “NET Stop HTTP”.
    I also went to my skype configuration and unchecked “Use Port 80 and 443 as alternatives for incoming connections”.

    XAMPP worked fine afterwards.

    • Yep, but this stop also many others services related to http.sys…

      In example print spooler to my system is related to http.sys -_-

  2. In Windows 2003 I just entered Services, found IIS Admin Service and select Stop
    Now port 80 is free!

  3. While I had a Windows Server 2008 / Tomcat problem, I think it would be applicable to Win 7 / Apache too.

    Many of the comments here were helpful, such as disabling http.sys (Control Panel -> System -> Device Manager. View -> Show Hidden Devices. Non-Plug and Play Drivers – > HTTP disable) but after trying everything, I was still stuck with http packets not reaching my Tomcat instance.

    What worked was disabling the firewall entirely. This was not immediately apparent as the Allow rule for port 80 traffic was on. As disabling the Windows firewall totally was not an option, I dug around till I found the solution.

    Seems that you need to explicitly allow the program listening on port 80 through the Firewall if its not a Windows service.

    So, I went to Control Panel\All Control Panel Items\Windows Firewall\Allowed Programs and added the path to my Tomcat program.

    Bingo!

    Hope this helps some soul forced to woefully wander in the world of windows.

  4. I try all above and didn’t work (BUT) i did sum more research and i found this way work for me so the ppl who try every thing above like me and did not work you should try this one…..

    Ok, after searching the web for a while I found a solution to my problem.

    Just follow these steps to diagnose and resolve your issue.

    Get pid that is listening port 80:

    netstat -nao | find “:80″
    Open task manager, go to processes tab and check “PID” on Menu/View/Select Columns…. then you can find out the procress with that pid.
    If it is a normal application or IIS, just disable, uninstall it. Some programs like Skype have the option to disable its use of port 80.
    If it is System progress(PID 4), you need to disable HTTP.sys driver which is started on demand by other service, such as Windows Remote Management/Print Spooler on Windows 2008 or Windows 7. There is two ways to disable it:

    Go to device manager, select “show hidden devices” from menu/view, go to “Non-Plug and Play Driver”/HTTP, double click it to disable it (and disable or manual some services depended on it).

    Reboot and use

    netstat -nao | find “:80″ to check if 80 is still used.

    Launch RegEdit
    Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
    Change the value of start to 4 (disabled)
    Reboot your computer

  5. This is a good correction process provided.
    The issue occuring on high end windows( 7, 8), because the http.sys listening to port 80.
    But I followed a different method to get this done by removing the process listening to IPV4 port 80

    netsh http add iplisten ipaddress=::

    even after this XAMPP didn’t started since it need IPV6 port as well to be released.
    For achieving this, I restarted HTTP process.

    net stop http
    net start http

    This worked perfectly. I got my XAMPP started and resume my work.

  6. Thankyou! This worked perfectly!

  7. I used Windows 8 but it’s not working, what can i do now ?

  8. Pingback: Apache Doesn’t Start On Windows XP Professional SP3 | Click & Find Answer !

  9. YEEESS! I’ve been trying to free port 80 for 3 hours now with no luck. Turnes out BranchCache was the problem, Not IIS or Web Deployment

  10. thanxxx it worked for me

  11. Pingback: 80端口被NTKernel&System占领 - 移动端开发 - 开发者第1586037个问答

  12. thanks advance..
    it’s working..

  13. Thank u very much.

  14. Ништяк, все работает! Пасиб.

  15. Pingback: 80端口被NTKernel&System占领 - 移动开发教程 - 开发者

  16. Pingback: XAMPP doesn't respond on Windows 7 host - Just just easy answers

  17. Pingback: Eric Credeur.com › Windows 7 – Port 80 and PID 4

  18. Remember to disable ports 80 and 443 from skype first.

Leave a Reply

Required fields are marked *.

*