Connection refused for port 80 in VirtualBox. But only for CentOS VM

2

1

after having this issue this morning I have done A LOT of reading of other questions. So hopefully I can provide plenty of info to assist in solving this

I can SSH using standard port 22 to the VM using either Bridged or Host-only networking. However when I try and visit a website (at this stage only hoping to see the welcome page) I get ERR_CONNECTION_REFUSED

  • I'm using VirtualBox 4.3.26 on OS X 10.10.3
  • The VM with the problem is CentOS 7 base
  • I have installed Apache2 (httpd) using yum
  • Apache is running
  • No issues with Ping
  • Internet connectivity fine fro mwithin VM when using any networking mode
  • SELinux is disabled
  • IPtables is disabled
  • SSH on 22 works fine

Netstat says we are listening on 80

tcp        0      0 :::80    :::*     LISTEN
  • I have an Ubuntu 14.10-server VM with no issues. Just installed Apache2 with apt-get and am able to see the welcome page at 192.168.0.102 (IP while testing with Bridged mode) as read from ifconfig same as I'm trying to do with CentOS

Does anyone know what my issue could be?

I can't think where the request is possibly being refused.

joevallender

Posted 2015-05-14T09:16:49.673

Reputation: 245

Have you started Apache on Centos? It doesn't automatically start after installation like with Ubuntu. I use Virtualbox a lot, and usually install a desktop VM instead of the server version if it's for local use only. It gives the same functionality, and a lot more convenience. You can use Firefox in the VM itself, as well as all the other GUI tools. – SPRBRN – 2015-05-14T09:24:20.843

Yes, Ill update the OP – joevallender – 2015-05-14T09:26:25.853

What do the httpd logs tell you? – SPRBRN – 2015-05-14T09:49:03.870

Nothing appears in access or error log unless, for instance I wget localhost from the VM itself – joevallender – 2015-05-14T10:06:25.767

Answers

6

By default CentOS 7 comes with firewalld installed. Check it is configured properly or disabled.

systemctl stop firewalld
systemctl disable firewalld

Jorge Martinez

Posted 2015-05-14T09:16:49.673

Reputation: 186

YES!!! Thanks Jorge. You know what? I was Googling 'centos firewall other than iptables' earlier. Didn't see this though. – joevallender – 2015-05-14T10:20:18.570

-1

It is really not recommended to disable the firewall, instead you could have run lokkit -s http to open up the port 80.

HawkEye

Posted 2015-05-14T09:16:49.673

Reputation: 1

This does not answer the author's question, this is more of a comment, then an answer. – Ramhound – 2015-06-09T11:17:37.680

It does have me interested though. @HawkEye are you saying that lokkit will configure both iptables and the firewalld mentioned in the accepted answer? I've never seen it before – joevallender – 2015-06-09T14:31:45.203

@joevallender - I have no clue about that, but let me know if it works for you! :) – HawkEye – 2015-06-10T06:46:01.700