Thanks to instructions from @MrLumute and @Tero Kilkanen, the issue is finally fixed after several days experiment.
Summarize as below:
Environment:
- webserver: Ubuntu 20.04 LTS + apache2 running in oracle VM virtual box
- oracle VM virtual box running in a windows10 PC
- windows10 PC connect to cox router which connect to internet
Purpose: host a public website in oracle VM virtual box which can be accessed from internet
Solutions:
1. register a domain name from an internet domain registar(eg,godaddy,bluehost)
2. create an A record to link your domain name to the router's public IP.
This needs to be done in the registar's domain management system after you registered.
3. enable router's http/https port and set port forwarding from router's public IP to PC's LAN IP
In my cox router, I have to firstly enable the http and https port of the router,
then forward the 2 ports to the LAN IP of the PC through the router's "port forwarding" configurations.
4. add a rule in windows firewall to allow inbound access for http port 8080
5. port forwarding http/https ports from PC LAN IP to VM IP
In windows 10, the following command can be run to do the port forwarding:
netsh interface portproxy add v4tov4 listenaddress=192.168.0.133 listenport=8080 connectaddress=192.168.0.122 connectport=80
listenaddress is the PC IP
connectaddress is the VM IP