Thursday, November 22, 2007

Troubleshooting Apache (blast from the past)

This happened to me last year April, and I blogged about it at the Jamaica Linux User Group website.

I thought it would be worth keeping, so I've "re-blogged" it here (am I allowed to do that?)

Got an email from a client this morning saying their site was inaccessible. After a bit of poking around, it was clear that the problem was related to Apache. I'm sure this will help someone else, so I'm blogging it.

I attempted to bring it backup using the init.d system (the message is outlined below):

  /etc/init.d/apache2 restart
Forcing reload of web server: Apache2 ...
no pidfile found! not running?(98)Address
already in use: make_sock: could not bind
to address [::]:443
no listening sockets available, shutting
Unable to open logs

Weird enough error!!!

Some process was hanging on to port 443.

My approach:

I checked to see if apache-ssl had been started by accident using `/etc/init.d/apache-ssl stop`. This was not the problem.

I used the netstat command to see if 443 was indeed in use:

  netstat -a |grep 443
ff (0.00/0/0) tcp6 422 0
ESTABLISHEDkeepalive? (7158.57/0/0)

It was... I wasn't sure what was using it

Tried to use `fuser` to do further diagnosis:

  fuser -n tcp 443
443/tcp: 5603

The result suggested that the process using port 443 was PID 5603 Due to lack of time (websites need to stay up) I had to just kill PID 5603.

Tried `kill 5603` but it stayed up, so I had to use a kill -9:

  kill -9 5603

Then started apache2:

  /etc/init.d/apache2 start

Back up and running :)

Would be nice to somehow make all of this into a script :)

No comments:

Sign up for my upcoming Plone 5 Book & Video tutorials

plone 5 for newbies book and videos