Reputation: 23360
I'm trying to restart my apache server using the comand:
service httpd restart
and I'm getting the following error :
Stopping httpd: [FAILED]
Starting httpd: [Sun Mar 18 12:28:14 2012] [warn] module proxy_ajp_module is already loaded, skipping
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs [FAILED]
what could be the problem?
Upvotes: 3
Views: 16462
Reputation: 879
One of my servers does this all the time. Here's some more detail:
sudo netstat -ltnp | grep ':80'
will return:
tcp6 0 0 :::80 :::* LISTEN ####/apache2
then use the #### (process id) number returned to kill the offending process that is using port 80, so that apache can bind it properly:
sudo kill -9 ####
Upvotes: 0
Reputation: 3645
If you get Permission denied
make sure you run the command with sudo or as root!
[dirt@stage ~]$ service httpd start
Starting httpd:
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address
0.0.0.0:80 no listening sockets available, shutting down
Unable to open logs [FAILED]
[dirt@stage ~]$ sudo service httpd start
Starting httpd: [ OK ]
Upvotes: 1
Reputation: 247
Normally a "could not bind to address" error means that another process is bound to port 80 preventing Apache from starting up on that port. This can happen if you are you using a caching server or another web server that is also using port 80, If this is the case, stop this alternate process and try restarting Apache again.
If you are not sure what is bound to port 80 you can use netstat to find out what is e.g.
netstat -lnp
However in your case it seems that the errors you are getting is because Apache is not being stopped before the restart attempts to start it i.e. the restart command tries to first stop the server and then start it again in a single command. Try:
service httpd stop
service httpd start
If you can figure out why the stop fails then you can also figure out why the restart fails.
Upvotes: 3