Apache restart failed
I did absolutely nothing in the last 24 hours to the server only for me to visit my websites today and got the "problem loading page" error.
The problem is my apache web server stopped working. Linode support verified this diagnosis.
What I need now is help getting it restarted. I have tried :
sudo apache2ctl restart but that only came back with the following message
httpd not running, trying to start
My linode is running on Ubuntu.
Can someone tell me what could have gone wrong and how I can fix this problem, please ?
8 Replies
sudo /etc/init.d/apache2 start
Alternatively, 'ps aux | grep apache2'
Then sudo kill -9 the process ids like 'sudo kill -9 1213' or whatever the PID is.
Then try starting apache.
@Nisstyre56:
sudo /etc/init.d/apache2 stop
sudo /etc/init.d/apache2 start
Alternatively, 'ps aux | grep apache2'
Then sudo kill -9 the process ids like 'sudo kill -9 1213' or whatever the PID is.
Then try starting apache.
Thanks for you input.
I tried both strategies last night but I just did so again.
starting with the kill command, I did ps aux | grep apache2 as you suggested.
I only got one line of output. I presume the process id is the first set of number from the left after the user id ?!?
I then tried the kill command with the process id but it came back with the following error:
-bash: kill: (3330) - No such process
Also, when I tried the same thing last night the process id was different. I don't know if that is normal ??
sudo /etc/init.d/apache2 stop - worked fine. The output was
Stopping web server apache2 [ OK ]
However, sudo /etc/init.d/apache2 start reported
Starting web server apache2 [fail]
@obs:
Also check your apache error log (probably in /var/log) for any errors.
I appreciate your input.
The error logs show that my website was missing a log directory and an error.log file.
I remember a friend telling me that apache would fail under such circumstances. I have drupal websites and I recently upgraded drupal core so I guess I wiped out and forgot to replace the log directory.
Once I recreated it, apache was happy to restart.
Thanks a great deal.
@sisko:
I tried both strategies last night but I just did so again.
starting with the kill command, I did ps aux | grep apache2 as you suggested.
I only got one line of output. I presume the process id is the first set of number from the left after the user id ?!?
I then tried the kill command with the process id but it came back with the following error:
-bash: kill: (3330) - No such process
Also, when I tried the same thing last night the process id was different. I don't know if that is normal ??
For future reference, when you do
ps aux | grep <something></something>
you should get two (or more) lines back if that thing you were looking for is running. One of them is the grep command itself that contains the searched string as a parameter, hence finding itself in the list of process. That's why kill doesn't find it later, it was there when the ps aux run, you got it's PID, but it's long gone when you try to kill it. Running the same command again will give grep a new PID.
So you are interested in the other line of output, the ones that (don|doesn)'t contain grep in (it|them).
@geppa:
For future reference, when you do
ps aux | grep <something></something>
you should get two (or more) lines back if that thing you were looking for is running.
There's a simple solution to this. Grep uses regular expressions. So, instead of:
ps aux | grep foo
Do this:
ps aux | grep [f]oo
No longer will you see two lines, because "grep [f]oo" won't match itself.
@Guspaz:
There's a simple solution to this. Grep uses regular expressions. So, instead of:
ps aux | grep foo
Do this:
ps aux | grep [f]oo
No longer will you see two lines, because "grep [f]oo" won't match itself.
coughsh-ismcough
> % ps aux | grep [f]oo
zsh: no matches found: [f]oo
ps aux | grep '[f]oo'
is the safe, portable option