How to Solve Port 80 Problems When Running Apache on Windows

    Craig Buckler
    Craig Buckler
    Share
    This article was written in 2011 and remains one of our most popular posts. If you’re keen to learn more about using Apache, you may find this more recent article on launching a VM with Apache CloudStack of great interest.
    If only clients realized the hassles developers encounter with their OS. Clients will call you the second their email fails (they forgot to switch on their router) or their website breaks (they’re using IE5.0). Who can you call when Apache won’t start because port 80 is blocked? Apologies for not writing a typical web development post but this is exactly the problem I encountered and it seems many others have too. I run Apache and IIS on Windows and prefer a server switching method so only one application listens on port 80 at any time. It works well and I’ve run similar set-ups on Windows 7, Vista, XP, and NT for many years. Today, however, Apache wouldn’t start. The following error appeared in the Application Event Viewer (Administrative Tools):
    The Apache service named  reported the following error:
    >>> (OS 10013) An attempt was made to access a socket in a way forbidden by its access permissions.
    :make_sock: could not bind to address 0.0.0.0:80.
    
    Another application was hogging port 80.

    The Obvious Candidates

    There are a number of well-known Windows programs which use port 80: IIS The most likely culprit is Microsoft Internet Information Server. You can stop the service from the command line on Windows 7/Vista:
    net stop was /y
    or XP:
    net stop iisadmin /y
    SQL Server Reporting Services
    SSRS can remain active even if you uninstall SQL Server. To stop the service:
    1. Open SQL Server Configuration Manager.
    2. Select “SQL Server Services” in the left-hand pane.
    3. Double-click “SQL Server Reporting Services”.
    4. Hit Stop.
    5. Switch to the Service tab and set the Start Mode to “Manual”.
    Skype Irritatingly, Skype can switch to port 80. To disable it, select Tools > Options > Advanced > Connection then uncheck “Use port 80 and 443 as alternatives for incoming connections”.

    What’s Using Port 80?

    Further detective work is necessary if IIS, SSRS and Skype are not to blame. Enter the following on the command line:
    netstat -ao
    The active TCP addresses and ports will be listed — locate the line with local address “0.0.0.0:80” and note the PID value. Now right-click the task bar and select Start Task Manager. Navigate to the Processes tab and, if necessary, click View > Select Columns… to ensure “PID (Process Identifier)” is checked. You can now locate the PID you noted above. The description and properties should help you determine which application is using the port. The Task Manager allows you to kill the process, but be a little wary about doing that — especially if it’s “NT Kernel & System”.

    Microsoft-HTTPAPI/2.0

    NT Kernel & System is an essential service. Stopping it will probably stop Windows in a blue-screeny-like way. Therefore, enter the following at the command line:
    telnet 127.0.0.1 80
    If you’re faced with a blank screen, type “GET” and hit return. The chances are, you’ll see a line stating that Microsoft-HTTPAPI/2.0 is listening on port 80. If that’s the case, open Services from Administrative Tools and locate “Web Deployment Agent Service”. Stop the service and set it’s startup type to “Manual”. The Web Deployment Agent Service is deployed with WebMatrix and was the cause of my woes. It may also be distributed with other applications installed using Microsoft’s Web Platform Installer. That caused me a few frustrating hours so I hope it solves your Apache or WAMP start-up problems. If you enjoyed reading this post, you’ll love Learnable; the place to learn fresh skills and techniques from the masters. Members get instant access to all of SitePoint’s ebooks and interactive online courses, like PHP & MySQL Web Development for Beginners.

    Frequently Asked Questions (FAQs) about Unblocking Port 80 on Windows to Run Apache

    What is Port 80 and why is it important for running Apache?

    Port 80 is the default port used by web servers for HTTP communication. Apache, a popular web server software, also uses this port to serve websites over the internet. When a user types a website address into their browser, the browser sends a request to the server via Port 80. The server then responds with the requested webpage. If Port 80 is blocked, the server cannot receive or respond to these requests, preventing the website from being accessible.

    How can I check if Port 80 is blocked on my Windows system?

    You can check if Port 80 is blocked by using the ‘netstat’ command in the Command Prompt. This command displays active TCP connections, ports on which the computer is listening, Ethernet statistics, the IP routing table, and protocol statistics. If Port 80 is open, it will be listed in the results.

    What could be blocking Port 80 on my Windows system?

    Several things could be blocking Port 80. It could be your firewall settings, antivirus software, or another application that is using the port. Skype, for instance, is known to use Port 80, which can cause conflicts with Apache.

    How can I unblock Port 80 on Windows?

    You can unblock Port 80 by adjusting your firewall settings. You can do this by going to the Control Panel, selecting System and Security, and then Windows Defender Firewall. From there, you can allow an app or feature through the firewall and select Apache.

    What should I do if another application is using Port 80?

    If another application is using Port 80, you can either change the port that the application is using or change the port that Apache is using. The process for changing the port will depend on the specific application.

    How can I change the port that Apache uses?

    You can change the port that Apache uses by editing the httpd.conf file, which is located in the Apache configuration directory. You will need to find the line that says ‘Listen 80’ and change it to ‘Listen’ followed by the new port number.

    Can I run Apache without unblocking Port 80?

    Yes, you can run Apache without unblocking Port 80 by changing the port that Apache uses. However, keep in mind that if you use a port other than 80, users will have to specify the port number when they enter your website address in their browser.

    What are the security implications of unblocking Port 80?

    Unblocking Port 80 can potentially expose your server to attacks, as it is a commonly targeted port by hackers. Therefore, it’s important to have proper security measures in place, such as a firewall and regular system updates.

    Can I unblock Port 80 on a non-Windows system?

    Yes, the process for unblocking Port 80 will vary depending on the operating system. On a Unix-based system like Linux or macOS, you can use the ‘iptables’ command to unblock the port.

    What should I do if I’m still having trouble unblocking Port 80?

    If you’re still having trouble unblocking Port 80, it may be helpful to consult with a professional or seek help from online communities. There are many forums and discussion boards where you can ask questions and get help from others who have experienced similar issues.