Issue
I can only access my nginx web server internally. The web server is hosted on my virtual machine. The outside world can not access it. By internally I mean within my virtual machine and the host machine, but not from an external device, e.g. my smartphone which is not connected to wi-fi. I have configured the virtual machine network settings to use Bridges Adapter, and I have configured port forwarding in my router (see images below). I can access the webserver on the host machine using both the external- and internal IP. Router has been restarted after configuration.
Goal
I want the outside world to be able to access my webserver.
Specifications
Host OS: Windows 10
Virtualization software: VirtualBox (Ubuntu Desktop 20.04.3 LTS)
Web server on VM: Nginx
VirtualBox Network configuration:
Attached to: Bridged Adapter
Name: Intel(R) 82579V Gigabit Network Connection
Adapter Type: Intel PRO/1000 MT Desktop (82540EM)
Promiscuous Mode: Allow All
All Name options:
Intel(R) 82579V Gigabit Network Connection
VirtualBox Host-Only Ethernet Adapter
VirtualBox Host-Only Ethernet Adapter 2
Router - Port forwarding
Status: ON | TCP | Port: 80 | External Host: <ip from checkmyip.com> | Internal Host: 192.168.0.100
ipconfig from virtual machine
mtu 1500
inet 192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::1070:8c81:f616:2b84 prefixlen 64 scopeid 0x20<link>
inet6 fdaa:bbcc:ddee:0:7c85:b26e:a007:cfd5 prefixlen 128 scopeid 0x0<global>
ether 08:00:27:c5:6f:79 txqueuelen 1000 (Ethernet)
RX packets 400 bytes 320675 (320.6 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 292 bytes 42926 (42.9 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 173 bytes 15040 (15.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 173 bytes 15040 (15.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
nginx configuration
...
server {
listen 80;
server_name 192.168.0.100;
}
...
Thanks!
Forward all packets received with source IP address <My.Own.Public.IP> and port 80 to 192.168.0.100
. By specifying the source IP you allow incoming traffic from that IP address only.0.0.0.0
,0.0.0.0/0
or0.0.0.0 255.255.255.255
.