Summary: In this post i tried to explain how to resolve the issue of apache bind address. The issue is Apache: could not bind to address to port (make_sock).
If you are going to upgrade server software, or sometime you try to make changes in the configurations files and you are restarting the apache. This time you Funk your Wang-alls.
Step-1: Check apache processes
ps -e | grep httpd
24215 ? 00:00:00 httpd
24217 ? 00:00:00 httpd
24218 ? 00:00:00 httpd
24219 ? 00:00:00 httpd
24220 ? 00:00:00 httpd
24221 ? 00:00:00 httpd
24222 ? 00:00:00 httpd
24223 ? 00:00:00 httpd
24224 ? 00:00:00 httpd
24225 ? 00:00:00 httpd
[root@imran~]# kill 24215
[root@imran ~]# kill 24215
-bash: kill: (21415) – No such process
[root@imran ~]# ps -e | grep httpd
[root@imran~]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: [ OK ]
Step-2: Start apache service
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 can’t because it’s already in use. There are a few reasons why this might be happening.
Port configuration problem:
If you configure duplicate Listen Entries in ports.conf and apache.conf it will bother you. So make sure you have single time entry in both files. either in apache.conf or in ports.conf. Other then that you have to check and confirm the apache.conf have single entry for ports.conf.
Listen 8080
#
# Listen 443
#Another service could be using the port
Step-3:I was ran to the same error because of apache another instance was already running. I used netstat, grep and kill the process and fix the problem.
# try to start apache, receive error
root@imran~: 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!
Step-4: See what applications using the port (note that I’m searching for :80, I could also use :8080)
root@imran~: 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!
root@imran~: killall -9 apache2
# Let’s try again, with success
~: sudo /etc/init.d/apache2 start
* Starting web server apache2
…done.
All we have to check and follow where we have catch the problem rather than restarting services again and again. The better is to dig the issue evaluate and resolve it properly.
Hope this will help someone and will save time.
0 Comments