Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Jan 9 '12 at 2:28

This question came from our site for professional and enthusiast programmers.

3 Answers 3

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.

share|improve this answer

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.