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.
Comments
We moved off of Disqus for data privacy and consent concerns, and are currently searching for a new commenting tool.
\u00a0Thanks for the answer. My issue is resolved.
Thanks for the answer. I had been stumped on this for a while. I kept looking at netstat, thinking that I must have another process listening on that port. Yours is the first answer that mentioned duplication on the Listen directive, which fixed my issue.
\u00a0thanks
Problem RESOLVED: i was facing same issue while configuring httpd with secure (443). I configured /etc/httpd/conf.d/ssl.conf and open port (listen 443), but forgot to close listen port on /etc/httpd/conf/httpd.conf file.
Answer : /etc/httpd/conf.d/ssl.conf\u00a0\u00a0\u00a0 – listen port 443\u00a0 should open here
/etc/httpd/conf/httpd.conf\u00a0 – listen port should be close (#).\u00a0
Oh man 😉
You saved my life 😉
Thanks
Thanks a lot, I stumbled upon the same problem
fixed my problem. Thanks Pete.
Thanks u vvvvv much
don’t forget the sudo!!!
thanks.
\u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e! \u0412\u044b \u043c\u0435\u043d\u044f \u043e\u0447\u0435\u043d\u044c \u0432\u044b\u0440\u0443\u0447\u0438\u043b\u0438..
Thank you!! Saved my day.
Hi Pete! You wrote you wanted to restart your Apache2, but I see you running \”start\” command. Currently I have situation, where \”restart\” causes same error – because apache2 is running – which is weird, as I want to restart it, and for some reason it doesn’t stop itself…
Thanks!
thanks
Thanks..!
In my case, the issue was apache2 was running.
I don’t knoww why yet, but, Apache2 instance of Xampp couldn’t start because my linux has other instance running. The weird thing is than I have worked a time without this trouble and one morning…
Well, thank you because I will not have this trouble any more.
Thanks a lot Pete ..
You saved the humanity .. 🙂
o luck my port was using by ngnix now i kill it and start httpd but mysite still down
Thanks Pete, these steps really helped. I was just stuck with this from 2 phreaking hours. Funny things is this post is still legitimate after 10 years. \ud83d\ude06
I had a similar problem but it was Nginx was latching onto to port 80. Ran ‘netstat -tulpn | grep :80’ and ‘systemctl status httpd’ ‘systemctl stop nginx’ then ‘systemctl start htppd’