Apache Address already in use: make_sock: could not bind to port 80 or 443 error and solution

Posted on in Categories , , , , , , , last updated September 26, 2007

Q. How do I fix an error, while restarting Apache ~ Address already in use: make_sock: could not bind to port 80?

A. If you are running SELinux disable temporary for port 80.

Apache Address already in use: make_sock: could not bind to port 80 error and solution

First make sure port 80/443 is not used by any other service or application with netstat command:

# netstat -tulpn| grep :80

If port 80 is bind to httpd, kill all process:
# killall -9 httpd

Now start the httpd:
# /etc/init.d/httpd start

Also make sure you are root while starting the httpd.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

35 comment

  1. Sir,

    I have already used above commands but still the problem persist. When i use netstat then no pid/program name displays associated with it as below output.

    netstat -tulpn | grep :80

    tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN –

    Please help me in this situation what should i do.

    thankyou.

    vijay

  2. Some linux builds are configured to include conf.d/ssl.conf which binds to the hosts IP at port 443. This will generate the same error mentioned here.

    I resolved the problem by deleting the VirtualHost block in /etc/conf.d/ssl.conf and commenting out the Listen 443 directive.

    One might run into this if they define their own instance with SSL enabled.

  3. Ok. I had the same issue. I was running Apache2 so after running the:

    sudo netstat -tulpn| grep :80

    I saw that apache2 was listening to that port. I shut all apache2 services down by doing the following:

    sudo killall -9 apache2

    Then ran:
    netstat -tulpn| grep :80
    to see if there was anything left open. If no results, the process was killed.

    Then start up your apache2 services using:

    sudo /etc/init.d/apache2 start

    This resolved my problems! Hope this helps others. What a freakin pain!!!!!

  4. And what if the system reboots? Than again port 80 is in use. So
    # netstat -tulpn| grep :80
    If port 80 is bind to httpd, kill all process:
    # killall -9 httpd
    Now start the httpd:
    # /etc/init.d/httpd start
    fixes the symtoms but it is not the solution.

  5. How can I know that my board MAC address is already in use or it’s free to use. That means How can I identify that someone else is using my Board’s Mac address or not ? Please post the command if it’s available.

    Thanks in advance

  6. If you are trying to bind to port 80, you may also want to try disabling selinux to see if that is an issue.

    echo 0 > /selinux/config /selinux/config <-enable

    The above tmp. sets that seeing and reboot clears it. To permanently set it to disabled

    vi /etc/selinux/config

    change
    SELINUX=enforcing
    to
    SELINUX=disabled

    Reboot or put in the temp change above until you can reboot.

    1. This error is possible due to many reasons. one of the is as below.

      If you have configured your apache with a listen address that is hitting 80 or 443 and if there is a duplicate entry in the same file, you would see this issue.
      Ex: Listen marsp1uat01-indianrails.com:80 (You see if this is configured more than once in the same .conf file)
      So, just remove the duplicate entry, save the .conf file and try to start it.

Leave a Comment