nginx on Ubuntu Server in VirtualBox on Windows 7, how to access localhost:8080

7,068

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:
7,068

Related videos on Youtube

thanks_in_advance
Author by

thanks_in_advance

Updated on September 18, 2022

Comments

  • thanks_in_advance
    thanks_in_advance over 1 year

    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?

    • Mitch
      Mitch over 8 years
      FYI, you can install command-line web browsers (I like lynx, sudo apt-get install lynx) to access it from the guest command line
  • Niek Klein Kromhof
    Niek Klein Kromhof over 10 years
    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/'.
  • thanks_in_advance
    thanks_in_advance over 10 years
    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 ?
  • Niek Klein Kromhof
    Niek Klein Kromhof over 10 years