Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

data retrieved ok

sudo -u apache curl

20 seconds later

curl: (7) couldn't connect to host

What would cause this, and how can I change it? I'm running some code as apache (mostly due to file permissions), and that code needs to be able to connect to another server.

Based on another question ( I thought maybe the answer would be in /etc/iptables, but that file doesn't use -m owner:

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited

SELinux is in permissive mode, as far as I can tell:

cat /selinux/enforce

What else could be causing this? RHEL 6.2.

share|improve this question
Can it connect to other servers? – Ignacio Vazquez-Abrams Apr 16 '12 at 6:03
As far as I can tell, I can connect to any server, and Apache (the user) can't connect to anything at all, including other servers on the same network. – Steve Bennett Apr 16 '12 at 6:08
up vote 2 down vote accepted

Ok, figured it out - it was a proxy issue. There was a proxy environment variable set in my start up scripts, that doesn't get called for apache.

share|improve this answer

Your Answer


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.