3

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?

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

3 Comments

for "service apache stop" I get "apache:unrecognized service", for "service httpd stop" I just get "Stopping httpd: [Failed]".
What Operating system are you using? What user are you logged in as? Could it be a permission issue? You could also be more aggressive to stop apache e.g. find out the parent process id for Apache and use kill to stop it before starting Apache with service httpd start. To get the process id for Apache run ps -ef | grep httpd and then use kill process_id (where process_id is the parent httpd process id)
thanks, that worked, in my case the name of the process to kill was "apache2" : ps faux | grep apache2
1

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 ] 

Comments

0

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 #### 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.