17

How can I configure my Apache server to run on port 80? My Apache service is failing when using Port 80; it says BUSY.

When I change the port in config to 85, Apache works but this requires maunally entering 85 in the address bar every time with localhost.

I have tried to find out which program is using port 80 but I cannot come up with anything. I first entered netstat -n -a -o -p TCP in cmd and I came up with this information

Local Address 0.0.0.0:80   State: Listening    PID: 4

Then I entered tasklist in cmd trying to figure out which service is using this port. Looks like "System" is on PID 4. I have configured Skype to not use port 80 without any luck. I have Microsoft WebMatrix installed on Windows 7 and I even deleted IIS 7.5 Server Express to free this port but all to no avail.

Can you guys please help me out? I am using Windows 7 and XAMPP.

Michael Currie
  • 13,721
  • 9
  • 42
  • 58
m.umar
  • 855
  • 4
  • 13
  • 23

6 Answers6

30

Several programs can block that port. Candidates are:

  • Skype
  • Web Deployment Agent Service (can be stopped via Start -> [-> Run] -> services.msc)
  • World Wide Web Publishing Service
  • IIS (if you have it installed)
  • TeamViewer
  • VMware (in VMware Workstation go to Edit>>Preferences>>Shared VMs, and Disable Sharing or change the port)

    Web Deployment Agent Service and World Wide Web Publishing Service can be set to manual start to keep them from running. Stop or change these services from an account that has administrator permissions. Skype and TeamViewer can be configured not to use port 80. For Skype Go to Options > Advanced > Connection and un-check "Use port 80 and 443 for incoming connections" For TeamViewer Go to Extra > Options > Advanced and un-check the similar message as above.

EDIT: I made the post a community Wiki, so if people find other programs, they can add them here.

heytools
  • 764
  • 3
  • 16
LueTm
  • 2,366
  • 21
  • 31
  • If you have skype running you can't start apache on 80. Just stop skype, then start apache and then start Skype (it only blocks 80 if it is already free). Of course this is only works if Skype is causing the problem. – LueTm Apr 29 '11 at 13:10
  • I have exited Skype and I even have unchecked Port 80 option in advanced but still no results. – m.umar Apr 29 '11 at 13:13
  • OK... when you make: netstat -abno -p TCP , there should be a line that says: TCP Listening. Above it there should be the application name in brackets []. What does it say? – LueTm Apr 29 '11 at 13:23
  • TCP 0.0.0.0:80 Listening PID 4. There is nothing above it. There are only headings Protoco, Local Address, Foreign Address, State, PID. But underneath it it says Can not Obtain ownership information. And then TCP 0.0.0.0:85 which has [httpd.exe] underneath it. I am using Apache temporarily on port 85. then TCP 0.0.0.0:135 then RpcSs and underneath [svchost.exe] running on TCP 0.0.0.0:443. – m.umar Apr 29 '11 at 13:31
  • http://support.microsoft.com/kb/281336 this explains how you get the process name from the PID ... this process really plays 'hard to get' though :) – LueTm Apr 29 '11 at 13:34
  • I already told you PID is 4 but in Task Manager there is no process with PID 4 only when tasklist is used in cmd does it show the process "System" which is running on PID 4. – m.umar Apr 29 '11 at 13:38
  • Sorry... does this help? http://stackoverflow.com/questions/1430141/port-80-is-being-used-by-system-pid-4-what-is-that – LueTm Apr 29 '11 at 13:41
  • 7
    Okay... Gotcha. Web Deployment Agent service was triggering "System" with Port id= 4 to use Port 80. I disabled it in Services, changed back to Port 80 in Apache config and bingo, Apache started working on its default port. Then I uninstalled Microsoft Web Deploy 2.0 to permanently remove this problem. Thank You LueTim for your prompt response. – m.umar Apr 29 '11 at 14:03
  • No problem. I'd appreciate a +1 though :D – LueTm Apr 29 '11 at 14:06
  • Sorry I cant do a +1. Im new and the website isnt allowing me. It says i need 15 reputation. Sorry! – m.umar Apr 29 '11 at 14:28
  • Ahhh.. sad faces all over the place :) Don't worry. Good luck! – LueTm Apr 29 '11 at 16:08
  • 1
    Just added the VMware solution which solved it for me after weeks of being clueless. – heytools Sep 20 '13 at 04:33
9

For me, it turned out to be that "Web Deployment Agent Service" was taking port 80. As soon as it was disabled apache started right up. I've also come across quite a few saying some of the SQL Server services were blocking it.

EDIT:
Just thought I'd add that the new MSN(Skype) causes this as well, using port 80 by default. It can be changed in the settings:

Tools > Options > Advanced > Connection > Untick "Use Port 80 and 443" > Save

Michael Currie
  • 13,721
  • 9
  • 42
  • 58
Chris Owens
  • 5,076
  • 12
  • 61
  • 131
5

You can also just change the port the Apache Web Server is using in the httpd.conf file.

In a Windows OS command prompt I use;

netstat -an

to see what services are already running, and what ports they are using, then just pick a port number that's not being used. Much simpler. That's for my Dev environment. On an actual server or in the cloud, I would run the Apache Web Server without conflicts and just shutdown anything else that happens to be using port 80.

GameDaddy
  • 51
  • 1
  • 1
  • 1
    I've just changed my port within `httpconf` to port 8080 and WAMP worked fine instantly. This solution is possibly easier than finding out which service is using port 80. – Luke Dec 04 '12 at 14:30
  • definitely --> Listen 8080: line 47 -- > ServerName localhost:8080: line176
    C:\xampp\apache\conf\httpd.conf
    – wilaponce Oct 19 '19 at 02:56
2

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!

2

Oh, thank you a thousand times. I've been wrestling all day with getting port 80 free. Tried everything that I found on the chat rooms, forums, including the regex edit above, and still there was:

netstat -ano -p tcp | findstr LISTENING

TCP    0.0.0.0:80             0.0.0.0                  LISTENING       4
TCP    0.0.0.0:445            0.0.0.0                  LISTENING       4  etc.

Now port 80 has disappeared from the display. What a relief!

Dan
  • 10,531
  • 2
  • 36
  • 55
0

Just thought I would put my input in: I stopped service MsDepSvc (AKA: Web Deployment Agent Service) and this solved the issue.

PCPGMR
  • 340
  • 2
  • 7