Nginx – Can’t access NGINX on Virtualbox machine : connection refused

arch-linuxfirewalllinux-networkingnginxvirtualbox

I've setup an ArchLinux box, on VirtualBox, where I installed and configured NGINX service to accept requests from anywhere.

listen 80;
server_name _;

I've also updated my UFW (and also tried disabled it) to allow from anywhere at WWW (80) and I've setup an host-only network bridge so I can access my box, from my Windows host, by static IP.

Status: active

To                         Action      From
--                         ------      ----
WWW                        ALLOW       Anywhere                  
WWW (v6)                   ALLOW       Anywhere (v6)   

enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.33.16  netmask 255.255.255.0  broadcast 192.168.33.255
        inet6 fe80::a00:27ff:fead:14c2  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:ad:14:c2  txqueuelen 1000  (Ethernet)
        RX packets 495  bytes 82862 (80.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 45  bytes 5446 (5.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

I can ping the box, at the given IP addr (from other GUEST machines and from HOST machine), and I can also cURL the IP (if I'm on the same network), but when I try to access it from my browser, at the Windows host, I can't: "This site can’t be reached"

PING : From HOST Windows machine

    Pinging 192.168.33.16 with 32 bytes of data: 
    Reply from 192.168.33.16: bytes=32 time<1ms TTL=128 
    Reply from 192.168.33.16: bytes=32 time<1ms TTL=128 
    Reply from 192.168.33.16: bytes=32 time<1ms TTL=128 
    Reply from 192.168.33.16: bytes=32 time<1ms TTL=128

    Ping statistics for 192.168.33.16:
        Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

CURL : From other GUEST machine inside same network

curl -I 192.168.33.16:80
HTTP/1.1 200 OK
Server: nginx/1.10.1
Date: Mon, 10 Oct 2016 11:02:03 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 31 May 2016 18:11:32 GMT
Connection: keep-alive
ETag: "574dd3d4-264"
Accept-Ranges: bytes

CURL : From HOST Windows machine

curl: (7) Failed to connect to 192.168.33.16 port 80: Connection refused

Any ideas why and how to fix it?

Thanks

Best Answer

Well.. after some time on trial and error, it seems that changing the network adapter and changing the IP range defined on that adapter did the trick. I don't know if that's how it's suppose to work but it did it. The major difference is that not all the virtualbox are in the same IP range.. My vagrant ones are, this fresh-install-from-scratch is not.

If someone got a better workaround or the real solution (so that we can use the same adapter and keeping all the boxes on the same network) please share with me (and the rest of us).

Thanks!

Related Topic