2

Here's my setup. I have a vm running with Oracle Linux 7 installed. I started apache with service httpd start and it started without issue. I've created an index.html file in both /var/www/html and /var/www. I'm able to reach the VM from my host machine using ping or ssh, but when I open a web browser and navigate to the IP address, the server doesn't respond.

I checked netstat -plent and it shows that port 80 is listening:

# netstat -plent
tcp6       0      0 :::80                   :::*                    LISTEN      0          121584     36432/httpd

I've looked at several answers that suggest iptables may be the issue, but none of those solutions helped. What else might be causing the problem?

ewok
  • 195
  • 1
  • 8

2 Answers2

3

You forgot to open the port in the firewall.

For instance.

firewall-cmd --add-service=http

Remember to make it permanent as well.

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
1

You're listening only on IPv6, going by that netstat output.

You need to either access the website only using IPv6, or create another listener directive in apache to listen on 0.0.0.0:80. In httpd.conf:

Listen 0.0.0.0:80

You can, of course, listen only on the IP address you want to serve traffic on.

This advice isn't right if you have support for dual-stack sockets in Linux, though. You might only need to check that dual-stack listening is turned on. Using procfs, check this file:

/proc/sys/net/ipv6/bindv6only

If it is not 0, you need to change it in your configuration to 0, or listen on IPv4 explicitly.

Also, check your firewall rules; if you're rejecting the traffic on ipv4 or ipv6, that would explain it. Check here:

iptables -t filter -nvL INPUT
ip6tables -t filter -nvL INPUT

If the default policy is not ACCEPT and you don't have a rule allowing HTTP traffic in, or if you have rules blocking it, that would explain.

Falcon Momot
  • 24,975
  • 13
  • 61
  • 92