Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a virtual server hosted by Aruba, running CentOS 6.5 (final). I have a problem with httpd. I can access the apache page from the server, and I also can reach test page that I create and put in var/www/html, but I can not do the same by another computer.

In the file /etc/httpd/conf/httpd.conf I just add the line: "listen 0.0.0.0:80", apache is running, I can see it from ps output:

root      6107  0.0  0.5 131488  5736 ?        Ss   15:26   0:00 /usr/sbin/httpd
apache    6109  0.0  0.2 130832  2744 ?        S    15:26   0:00 /usr/sbin/httpd
apache    6110  0.0  0.3 131488  3164 ?        S    15:26   0:00 /usr/sbin/httpd
apache    7147  0.0  0.3 131488  3164 ?        S    15:29   0:00 /usr/sbin/httpd
apache    7148  0.0  0.3 131488  3164 ?        S    15:29   0:00 /usr/sbin/httpd
apache    7149  0.0  0.3 131488  3164 ?        S    15:29   0:00 /usr/sbin/httpd
apache    7150  0.0  0.3 131488  3164 ?        S    15:29   0:00 /usr/sbin/httpd

Here's the output of nmap with the IP address of the server as argument:

PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
25/tcp   open  smtp
53/tcp   open  domain
80/tcp   open  http
110/tcp  open  pop3
143/tcp  open  imap
443/tcp  open  https
465/tcp  open  smtps
993/tcp  open  imaps
995/tcp  open  pop3s
3306/tcp open  mysql
8443/tcp open  https-alt

The port number 80 looks open... How can I solve this?

EDIT: here's my iptables-save output:

# Generated by iptables-save v1.4.7 on Thu Mar 13 15:55:55 2014
*nat
:PREROUTING ACCEPT [6:312]
:POSTROUTING ACCEPT [1:60]
:OUTPUT ACCEPT [1:60]
COMMIT
# Completed on Thu Mar 13 15:55:55 2014 
# Generated by iptables-save v1.4.7 on Thu Mar 13 15:55:55 2014
*mangle
:PREROUTING ACCEPT [75:4926]
:INPUT ACCEPT [75:4926]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [53:4095]
:POSTROUTING ACCEPT [53:4095]
COMMIT
# Completed on Thu Mar 13 15:55:55 2014
# Generated by iptables-save v1.4.7 on Thu Mar 13 15:55:55 2014
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:VZ_FORWARD - [0:0]
:VZ_INPUT - [0:0]
:VZ_OUTPUT - [0:0]
 -A INPUT -j VZ_INPUT 
 -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
 -A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -j REJECT --reject-with tcp-reset 
-A INPUT -m state --state INVALID -j DROP 
-A INPUT -i lo -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 12443 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 11443 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 11444 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 8447 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 8443 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 8880 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 587 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 25 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 465 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 110 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 995 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 143 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 993 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 106 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 3306 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 5432 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 9008 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 9080 -j ACCEPT 
-A INPUT -p udp -m udp --dport 137 -j ACCEPT 
-A INPUT -p udp -m udp --dport 138 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 139 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 445 -j ACCEPT 
-A INPUT -p udp -m udp --dport 1194 -j ACCEPT 
-A INPUT -p udp -m udp --dport 53 -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT 
-A INPUT -p udp -j ACCEPT 
-A INPUT -p tcp -j ACCEPT 
-A INPUT -p icmp -m icmp --icmp-type 8/0 -j ACCEPT 
-A INPUT -j DROP 
-A FORWARD -j VZ_FORWARD 
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT  
-A FORWARD -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -j REJECT --reject-with tcp-reset 
-A FORWARD -m state --state INVALID -j DROP 
-A FORWARD -i lo -o lo -j ACCEPT 
-A FORWARD -j DROP 
-A OUTPUT -j VZ_OUTPUT 
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
-A OUTPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -j REJECT --reject-with tcp-reset 
-A OUTPUT -m state --state INVALID -j DROP 
-A OUTPUT -o lo -j ACCEPT 
-A OUTPUT -j ACCEPT 
-A VZ_INPUT -p tcp -m tcp --dport 80 -j ACCEPT 
-A VZ_INPUT -p tcp -m tcp --dport 22 -j ACCEPT 
-A VZ_INPUT -p tcp -m tcp --dport 25 -j ACCEPT 
-A VZ_INPUT -p tcp -m tcp --dport 110 -j ACCEPT 
-A VZ_INPUT -p tcp -m tcp --dport 53 -j ACCEPT 
-A VZ_INPUT -p udp -m udp --dport 53 -j ACCEPT 
-A VZ_INPUT -p tcp -m tcp --dport 32768:65535 -j ACCEPT 
-A VZ_INPUT -p udp -m udp --dport 32768:65535 -j ACCEPT 
-A VZ_INPUT -p tcp -m tcp --dport 8880 -j ACCEPT 
-A VZ_INPUT -p tcp -m tcp --dport 8443 -j ACCEPT 
-A VZ_INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -p tcp -j ACCEPT 
-A VZ_INPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -p udp -j ACCEPT 
-A VZ_OUTPUT -p tcp -m tcp --sport 80 -j ACCEPT 
-A VZ_OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT 
-A VZ_OUTPUT -p tcp -m tcp --sport 25 -j ACCEPT 
-A VZ_OUTPUT -p tcp -m tcp --sport 110 -j ACCEPT 
-A VZ_OUTPUT -p tcp -m tcp --sport 53 -j ACCEPT 
-A VZ_OUTPUT -p udp -m udp --sport 53 -j ACCEPT 
-A VZ_OUTPUT -p tcp -j ACCEPT 
-A VZ_OUTPUT -p udp -j ACCEPT 
-A VZ_OUTPUT -p tcp -m tcp --sport 8880 -j ACCEPT 
-A VZ_OUTPUT -p tcp -m tcp --sport 8443 -j ACCEPT 
-A VZ_OUTPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -p tcp -j ACCEPT 
-A VZ_OUTPUT -s 127.0.0.1/32 -d 127.0.0.1/32 -p udp -j ACCEPT 
COMMIT
# Completed on Thu Mar 13 15:55:55 2014
share|improve this question
    
What is the problem you are having? –  Michael Hampton Mar 13 at 14:38
    
Like i said I cannot access the web server but from localhost! –  user2428124 Mar 13 at 14:39
    
stop iptables if running and check in your centos box or open port 80 in iptables. –  Abhishek Anand Amralkar Mar 13 at 14:44
    
also check selinux setenforce 0. and try to access . –  Abhishek Anand Amralkar Mar 13 at 14:45

5 Answers 5

Maybe your nmap box has access to your apache box. Or maybe your apache box is behind a router that does nat and not forward port 80.

You should describe your setup in more detail. From what you have there the box should be accessible from the internet. If not filtered by a gateway/w/e.

share|improve this answer
    
What others information do you need? I don not think that this is the problem since I also tried with a smartphone with a 3g connection, so by-passing my router/gateway/others. –  user2428124 Mar 13 at 15:05
    
do you by chance have a htaccess somewhere restricting access to all but localhost ? From what you said you can't access it from anywhere else but now you're saying you can access it from your smartphone ? So what's it going to be ? localhost only or localhost + smartphones only ? this does not make sense unless apache filters by ip and or user agent. –  Horatiu Mar 13 at 15:24
    
I can access my server from anywhere, but I can NOT access my web server from anywhere but localhost. I only tried with the smartphone, but I did not succede! –  user2428124 Mar 13 at 15:27
    
does the client receive an error ? or does the page just hang ? if it receives a http error response - the likes of 404, 403 etc indicate there is a misconfigured apache setting. if the page just hangs it indicates there is a firewall blocking traffic somewhere. are you sure your hypervisor(the machine hosting your virtual server) isn't filtering anything ? perhaps you can check your control panel for ports forwarding or perhaps you have ssh access to the hypervisor and do some checking there. You are running apache in an openvz instance by the looks of it –  Horatiu Mar 13 at 15:32

If you can access the server locally, but not remotely, then chances are you have a firewall problem.

If you run "iptables -I INPUT -p tcp --dport 80 -j ACCEPT" does that resolve the problem?

share|improve this answer
    
I run the command but the situation remain the same! EDIT: now I see that yuo write "can access the server". I can access the server, but I can not access the web server (apache) ! Pratical example: telnet server-ip 80 works, but if I try to connect to server-ip/test.html I cannot see the page but from localhost! –  user2428124 Mar 13 at 14:52

By default, apache listens to all addresses, but if you specified listen 0.0.0.0:80, it will only listen to connection addressed to 0.0.0.0, i.e. local connections.

share|improve this answer
    
You are right. I just changed that line with listen 80 But nothing changed :( –  user2428124 Mar 13 at 15:14

Did you check if firewall (iptables) blocking the connections ? Try disable iptables and selinux to troubleshoot.

Perform a telnet on server IP on port 80 from the remote PC using which you cannot access apache. Let us know what is the output.

share|improve this answer
    
For questions and clarifications, use comments. –  ETL Mar 15 at 3:46

it's not open, not necessarily, it's listening.

that being said, allow it through your firewall:

iptables -I INPUT -p tcp -m multiport --dport 80,443 -j ACCEPT

should allow incoming traffic to reach ports 80 and 443.

share|improve this answer

Your Answer

 
discard

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.