Tuesday, May 29, 2012

FreeBSD Apache Jail: Connection refused: connect to listener on 0.0.0.0:80 Error and Solution

Q. I'm running Apache 2 server under FreeBSD jail. However, I see lots of warning error messages in /var/log/httpd-error.log as follows:
[Sat Sep 20 20:47:09 2008] [warn] (61)Connection refused: connect to listener on 0.0.0.0:80
[Sat Sep 20 20:47:10 2008] [warn] (61)Connection refused: connect to listener on 0.0.0.0:80
[Sat Sep 20 20:47:11 2008] [warn] (61)Connection refused: connect to listener on 0.0.0.0:80
How do stop all these warning messages flooding my Apache log files?

A. Under FreeBSD jail you do not have loopback address - 127.0.0.1 and 0.0.0.0. So do not configure any server including httpd with 0.0.0.0 or 127.0.0.1 IP address. You need to always set your actual, real IP. Open httpd.conf
# vi /usr/local/etc/apache22/httpd.conf
Find out Listen directive:
#Listen 12.34.56.78:80
Listen directive allows you to bind Apache to specific IP addresses and/or ports, instead of the default. Change this to Listen on specific IP addresses as shown below to prevent Apache from glomming onto all bound IP addresses i.e. 0.0.0.0 which is not available in jail, so if your IP is 202.54.1.2, enter:
Listen 202.54.1.2:80
Save and close the file. Restart apache:
# /usr/local/etc/rc.d/apache22 restart

No comments:

Post a Comment