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

by Vivek Gite [Last updated: September 25, 2008]

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

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , , , , , , , ,

Previous post: Linux Error: Page Allocation Failure and Solution

Next post: Alarm clock: How To Set Timeout For A Shell Command