Skip To Main Content

Apache: Could not bind address to port (make_sock)

Posted by Pete Karl

Sep 03 2010

If you’re upgrading server software, or changing your port config, you may accidentally Funk your Wagnalls. You’ll know the error when you try to restart apache.

~: sudo /etc/init.d/apache2 start
 * Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
Unable to open logs
   ...fail!

Apache is attempting to listen on port 8080, but cannot because it’s already in use. There are a few reasons why this might be happening.

Port configuration problem

If you have have duplicate entries, Apache will yell at you. Make sure that your apache.conf & ports.conf don’t both include this directive. If it’s only being listed once (see the example ports.conf below), then make sure you didn’t accidentally duplicate your ports.conf somewhere apache would notice.

Listen 8080

#<IfModule mod_ssl.c>
# Listen 443
#</IfModule>

Another service could be using the port

When I ran into this error, it was because another instance of apache was already running. This next example uses netstat, grep, and kill to root out & fix the problem.

# try to start apache, receive error

~: sudo /etc/init.d/apache2 start
 * Starting web server apache2
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
Unable to open logs
   ...fail!

# see what's using the port (note that I'm searching for :80, I could also use :8080)

~: sudo netstat -tulpn| grep :80

tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      29004/apache2
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      28964/nginx

# I see that apache2 is using 8080! Kill it!

~: killall -9 apache2

# Let's try again, with success

~: sudo /etc/init.d/apache2 start
 * Starting web server apache2
   ...done.

Remember to dig in and evaluate server problems instead of just rebooting. I rebooted four times before I decided that I must have screwed something up.

Posted by
Pete Karl
on September 3rd, 2010

Comments

We moved off of Disqus for data privacy and consent concerns, and are currently searching for a new commenting tool.

Contact Us

We'd love to hear from you. Get in touch!