Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
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/'. –  Niek Klein Kromhof Sep 29 '13 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 ? –  user1883050 Sep 29 '13 at 9:02
    
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.