1

I made an image of one of my private Amazon EC2 image that runs one website, then started installing redmine. After all the installation is done, it is about to restart Apache I encountered the following issue(sorry you might have to zoom in to see the screenshot): enter image description here

My understanding of what was happening is that apache2 is not running but it is listening to port 80. Then I tried: enter image description here which gives the same confusing but consistent conclusion, apache2 is not running, but I am sure it is process 18304 which is apache2 listening to port 80. Eventually, I had to kill the process and restart apache which worked. Could someone explain to me what might have caused this and a fix?

Update1:

Following synthesizerpatel suggestion to use lsof. enter image description here This is exactly the same problem with different process as before.

Michael Z
  • 121
  • 1
  • 5

4 Answers4

1

Sometimes when you stop apache (or any other program) the script can't properly shut down the program because it waits for something (for example IO) but deletes the pid file. So the script beleives that apache is not running because there is no pid file but apache is runs, or sometimes not really rund but stuck in and sits on the port.

In these cases you have to kill the process and you can start the program. I have seen many this kind of stuck processes from apache, slapd, cirus, ... sometimes it happens.

Stone
  • 6,941
  • 1
  • 19
  • 33
0

Try running

lsof -n | grep TCP 

Also.. the apache2 controller isn't always the most reliable, it just checks for a PID file, not the actual process.

ps -aef | grep httpd

$1 says you've still got an httpd running.

synthesizer
  • 101
  • 1
0

As the poster says above, use

lsof -n | grep TCP

or

lsof -n | grep "*:www"

Also, in Ubuntu, it uses the process name "apache2" so you should be checking for it with

ps -ax |grep apache

Instead of grep httpd

Jon
  • 632
  • 5
  • 12
0

Run

ps aux|grep apache

Do you see

/usr/share/apache2/ask-for-passphrase localhost:443 RSA

If so

One of the sites containes an SSL certificate with a passphrase. So when apache was trying to start at boot time it could not continue without someone manually entering the passphrase.

So you have two options to fix this problem:

  1. Add a SSLPassPhraseDialog directive to your config.

  2. Remove your passphrase (Less secure)

AdamG
  • 171
  • 5