I have installed a fresh Ubuntu 16.04-server on Virtualbox on my Windows 10. After the installation I installed Nginx. I set the port to 81 because port 80 is being used by a process I can't identify. I can ping the IP of the VBox which is 10.0.2.15 and when going to http://localhost:81 or http://10.0.2.15:81 or http://127.0.0.1:81, nothing is displayed. Tried to Google this problem but still unable to figure out how to solve it. Could there be a conflict with my XAMPP installation or my modified windows hosts file I added some redirects for my local development for XAMPP like dev.myproject.com and test.myproject.com
Asked
Active
Viewed 5,366 times
2 Answers
5
VirtualBox creates virtual machines with the NAT network type by default. If you want to access a web server as nginx inside a virtual machine, you’ll need to forward all necessary ports through the virtual NAT into the vm. Just do the following:
- Open your virtual machine’s settings window.
- Select the Network pane, check that you are using NAT, expand the Advanced section and click on the Port Forwarding button.
- Create a port forwarding rule. Specifying a host and/or guest IP is optional, so just leave it blank. The host port is the port from which you want to access the web server from the outside, e.g. 2215, and the guest port is the port on which your web server is actually running within the vm, e.g. 81.
Now you can access the web server by opening http://hostip:2215 . Another solution would be a proxy pass/proxy pass reverse.

Lonkey
- 183
- 10
0
If your VM has an IP address on it's own (you can find out by)
1- inside your terminal, type in ifconfig and see if you have a new ip address in your machine, this is your ip address 2- you might need to use iptables inside your linux machine to open up port 81 as I don't think it is open by default. you can try from within your Ubuntu telnet {{external_IP}} 81

irimawi
- 368
- 1
- 9
-
using the command sudo lsof -i :81, I got Nginx on the list. Thenks – putoshop Jun 15 '16 at 16:14