Can't access NGINX from host even though SSH works fine?

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
N00bie
Posts: 13
Joined: 8. Jul 2014, 17:00

Can't access NGINX from host even though SSH works fine?

Post by N00bie »

I created a VirtualBox Ubuntu Server VM on my OSX host and created NAT and Host-only Adapters.

This is how I created the adapters:

Code: Select all

    vboxmanage modifyvm "testvm" --memory 8192 --vram 64 --acpi on --boot1 dvd --nic1 nat
    vboxmanage modifyvm testvm --natpf1 "ssh,tcp,,2200,,22"
The guest VM has Internet access. After adding the following to "/etc/network/interfaces":

Code: Select all

    auto eth1
    iface eth1 inet static
        address 192.168.33.1
        netmask 255.255.255.0
I became able to SSH into the server, like so:

Code: Select all

    ssh -p2200 nate@192.168.33.1
Once in the server, I can access NGINX through CURL in the terminal. Commands such as:

Code: Select all

    curl localhost
    curl 192.168.33.1
Output the NGINX welcome page.

I can ping 192.168.33.1 from my host machine, but if I try going to 192.168.33.1 in my browser, I get:

Code: Select all

This webpage is not available
ERR_CONNECTION_REFUSED
This is the output of "ifconfig" in the guest:

Code: Select all

    eth0      Link encap:Ethernet  HWaddr 08:00:27:92:21:37  
              inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
              inet6 addr: fe80::a00:27ff:fe92:2137/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:304 errors:0 dropped:0 overruns:0 frame:0
              TX packets:229 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:29278 (29.2 KB)  TX bytes:29374 (29.3 KB)
              Interrupt:10 Base address:0xd020 
    
    eth1      Link encap:Ethernet  HWaddr 08:00:27:af:7a:9e  
              inet addr:192.168.33.1  Bcast:192.168.33.255  Mask:255.255.255.0
              inet6 addr: fe80::a00:27ff:feaf:7a9e/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:37 errors:0 dropped:0 overruns:0 frame:0
              TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:5772 (5.7 KB)  TX bytes:648 (648.0 B)
              Interrupt:9 Base address:0xd060 
    
    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:20 errors:0 dropped:0 overruns:0 frame:0
              TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:3137 (3.1 KB)  TX bytes:3137 (3.1 KB)
What do I need to do in order to be able to access NGINX from my host machine? Is this a firewall, networking, or permissions issue?
Post Reply