Sunday, April 12, 2009

HTTPD ERRORS AND TROUBLESHOOTING

(1) Address already in use: make_sock: could not bind to address - Apache - HTTPD Error

While restarting httpd service, getting below error

root@srv [/tmp]# service httpd start
[warn] NameVirtualHost
xx.xx.xx.xx:80 has no VirtualHosts
(98)Address already in use: make_sock: could not bind to address
0.0.0.0:443
no listening sockets available, shutting down
Unable to open logs

If you are not able to start httpd and unable to open log

root@srv [/tmp]# tail -f /usr/local/apache/logs/error_log
[Sun Apr 12 03:26:05 2009] [error] could not make child process
11204 exit, attempting to continue anyway
[Sun Apr 12 03:26:05 2009] [error] could not make child process
11208 exit, attempting to continue anyway
[Sun Apr 12 03:26:05 2009] [error] could not make child process
11210 exit, attempting to continue anyway
[Sun Apr 12 03:26:05 2009] [error] could not make child process
11230 exit, attempting to continue anyway
[Sun Apr 12 03:26:05 2009] [error] could not make child process
11231 exit, attempting to continue anyway
[Sun Apr 12 03:26:05 2009] [error] could not make child process
11233 exit, attempting to continue anyway

The fix is as follows. Run the following command
check if anyother service is running on port 80 instead of httpd and if it is running then stop that service or kill that process forcefully and try to start httpd.

netstat -lnp | grep '0.0.0.0:80'
# output
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 30982/crond

In my case the output showed that crond was using the port. I

ran the following to learn more

ps 30982
PID TTY STAT TIME COMMAND
30982 ? S 0:34 crond

I tried the following a couple of times

service crond stop OR kill -9 processid

and then

service httpd restart
Stopping httpd: [FAILED]
Starting httpd: [ OK ]

and later


service crond start
Starting crond: [ OK ]

===================================