Apache restart failed

Hi,

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

Also check your apache error log (probably in /var/log) for any errors.

@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).

Unless of course you were looking for a run amok grep per se, one that is upping your linode I/O rate to the clouds and completely flats at 100% one CPU core, for someone put too little specificity in the path that it was recurring on. :roll:~~~~

@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 ;)

@sisko:

However, sudo /etc/init.d/apache2 start reported Starting web server apache2 [fail]

check your apache logs, you likely have a configuration error.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct