Opening Up Port 80 For Apache to Use On Windows

For Apache to be able to start/run, it has to be able to bind to (and listen on) port 80 (the HTTP port).

If after installing Apache (or a WAMP such as WampDeveloper Pro), rebooting, and trying to start Apache again – Apache is not able to bind to port 80 and start, then another Application or Service has already taken this port.

For Apache to start, we have to figure out what’s using port 80 (and possibly port 443) on your system, and stop and disable it.

Known Windows Services That Listen on Port 80

From Services Manager (run: services.msc), stop and disable these native Windows Services which are known to bind to port 80.

Double click Service, and change ‘Startup Type’ to ‘Disabled’.

  1. SQL Server Reporting Services (ReportServer)
  2. Web Deployment Agent Service (MsDepSvc)
  3. BranchCache (PeerDistSvc)
  4. World Wide Web Publishing Service (W3SVC)
  5. Internet Information Server (WAS, IISADMIN)

You might, or might not, have some of these Services installed and running.

HTTP (HTTP.SYS) Hidden Driver/Service

Windows Server 2003/2008/2012 and Windows XP(SP2)/Vista/7/8 come with an HTTP front-end proxy service who’s job is to parse and forward incoming HTTP requests to other Services.

Values in URL “http://hostname:port/virtual_url_or_dir” are registered with it, and when an HTTP request comes in that matches on those values, that request gets routed to the other application or service (which itself is running on a different port).

HTTP.SYS is usually started “on demand” by other services (Windows Remote Management, Print Spooler, etc), and is not usually listening on port 80 until some other application registers a HOST (127.0.0.1) + PORT (80) + virtual URL/DIR with it. HTTP.SYS runs under PID 4 (NT Kernel).

On some Windows systems, oftentimes port 80 is already taken by HTTP.SYS for use.

Show Reserved URLs:

netsh http show urlacl

Show active Registered URLs:

netsh http show servicestate

To Disable HTTP.SYS:

Control Panel > Device Manager
In menu View, select: Show hidden devices
Open tree: Non-plug and Play Drivers
Double-click: HTTP
Tab Driver - Group Startup
Switch from: Demand to Disabled

Or run this from the administrative privledged command-line (right click cmd.exe, select – run as admin):

net stop http
sc config http start= disabled

Other Web-Server Applications

Make sure you’re not running:
A. Other instances of Apache
B. IIS and/or WebMatrix
C. Tomcat

IIS and Tomcat are web-server applications that also bind to port 80 by default.

IIS can be removed via Windows Features on Vista/7/8, or on Windows Server via Role and Components Removal.

Skype

Skype usually takes up ports 80 and 443.

You’d need to stop Skype and change its settings to not use these ports:

Tools > Options > Advanced > Connection
Uncheck "Use Port 80 and 443 for incoming connections"

Or set Apache’s Startup type as “Automatic”, this way Apache might start before Skype does, and will be able to bind to port 80 and 443 before any other application has a chance to take these ports.

*Skype for Windows 8 (Modern UI) is not able to change port numbers. Only “Skype for Desktop” can do this.

TeamViewer

To disable TeamViewer from using port 80:

Extras > Options > Advanced
Enable option "Don't use incoming port 80"

VMware Host Agent service

The VMware Host Agent service uses TCP ports 80 and 443 by default.

Edit > Preferences > Shared VMs
Change the ports

VMware, Configure Virtual Machine Sharing and Remote Access

Use NETSTAT to Detect Port 80 Listeners

Open the command line (System tab, button: Command Line) and run:

netstat -o -n -a | findstr 0.0.0.0:80
netstat -o -n -a | findstr 127.0.0.1:80

Inspect the lines with a “Local Address” showing port 80 and/or 443 use. Note the PID number. Then open Task Manager (run: taskmgr.exe), go to it’s Processes Tab, see if you can find the application with that same PID number. It needs to be shut down. If you don’t see it, click “Show processes from all users” button.

http://support.microsoft.com/kb/281336

On some systems you can also get the PID directly by using netstat’s ‘-b’ option:

-b    Displays the executable involved in creating each connection or
      listening port. In some cases well-known executables host
      multiple independent components, and in these cases the
      sequence of components involved in creating the connection
      or listening port is displayed. In this case the executable
      name is in [] at the bottom, on top is the component it called,
      and so forth until TCP/IP was reached. Note that this option
      can be time-consuming and will fail unless you have sufficient
      permissions.

5 thoughts on “Opening Up Port 80 For Apache to Use On Windows

  1. Vic

    Thank you!! Your list of Windows services is the most comprehensive I’ve found! It was the SQL Report Service that did it for me. Wasted 24 hours tracking this down. Thank you!!

    Reply
  2. Danny

    Awesome!!! I had disabled IIS services from windows 8 but port 80 was still in use by some pid 4 system process. Turns out that the Web Deployment Agent Service (MsDepSvc) was running and set to turn on automatically. I disabled startup and stopped service – apache is backup and running :) thanks

    Reply
  3. admin Post author

    When all else fails to uncover the application that is using port 80, try communicating with it to see what information is outputs…

    1. Install PuTTY, which can communicate via telnet protocol.

    2. Open Session with the following settings:

    Host Name: 127.0.0.1
    Connection type: Telnet
    Port: 80
    Close window on exit: Never
    

    Click – Open.

    3. Type in:

    GET / HTTP/1.1
    HOST: localhost

    Press enter key again.

    If the culprit is a web application / server, it might give up it’s details, or provide clues to you.

    Reply

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>