5

I have nginx running on Ubuntu Server (guest) in VirtualBox on Windows 7 (host)

I need to access the nginx webserver's localhost.

I'm assuming there's no way to do this directly from Ubuntu Server's terminal, because I probably need a browser to do this and there's no browser there.

So, I need to access the nginx webserver's localhost from the host's browser.

How do I configure NAT port-forwarding on VirtualBox to accomplish this?

1
  • FYI, you can install command-line web browsers (I like lynx, sudo apt-get install lynx) to access it from the guest command line
    – Mitch
    Jan 21, 2016 at 16:17

1 Answer 1

1

Check the nginx.conf file and look for the listen address. It might be set to only listen on 127.0.0.1, check the documentation for available options, but usually changing the listen address (or adding) 0.0.0.0 will make it listen on all interfaces and you'll be able to access the webserver on your guest's ip address at the appropriate port. Don't forget to restart nginx after editing its .conf file to activate changes.

Alternatively you could create a port forwarding over SSH using PuTTY, and you could access your guest's webserver via localhost on your host, but it's the more complicated option here I think.

3
  • I should add for clarification: I don't use nginx myself, but the configuration is often more or less the same for different webservers. You might also look at the 'sites-enabled' directory under '/etc/nginx/'. Sep 29, 2013 at 8:45
  • Thanks Niek -- regarding SSH over PuTTY, I'm already using it to access the terminal on the guest (so that I can share the clipboard between Windows and Ubuntu-Server), but are you saying there's a way to use SSH over PuTTY to access the nginx webserver as well ? Sep 29, 2013 at 9:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .