How to run VM as a webserver

Discussions related to using VirtualBox on Linux hosts.
Post Reply
satimis
Posts: 513
Joined: 12. Jun 2007, 03:41

How to run VM as a webserver

Post by satimis »

Hi all,

How to run VM as a webserver, visible to public?

For example;

Code: Select all

Public address of PC - 111.222.333.444
Local IP address of the VM - 192.168.0.111
Please advice. Thanks

Regards
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How to run VM as a webserver

Post by scottgus1 »

If 192.168.0 is your LAN's IP address, then you may be mostly there.

Your guest should be Bridged, and the web service should be available to other computers in your LAN by accessing the guest at 192.168.0.111:portnumber. (or just 192.168.0.111, where the port number is 80 http or 443 https by default).

Once your LAN computers can access the web service, the Virtualbox part is complete. Pretend the guest is just another computer on the LAN. Open ports in your LAN router to the LAN computer that runs the web service (which is the guest). Consult the web on how to open ports in your router to a LAN computer.
satimis
Posts: 513
Joined: 12. Jun 2007, 03:41

Re: How to run VM as a webserver

Post by satimis »

scottgus1 wrote:If 192.168.0 is your LAN's IP address, then you may be mostly there. ......
Hi,

On Internet, visitor just enter domain.com on browser to browse its website.

I have cloned the live websites on VM in their folders. e.g.
site1
site2
site3
etc.

On LAN, local network, users can browse the websites running on browser;

Code: Select all

192.168.0.111/site1
192.168.0.111/site2
192.168.0.111/site3
etc.
But I have no idea how they can be browsed on Internet?

My PC is connected to 500M FTTH with fixed public IP address. I can upgrade it to 1000M.

Regards
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: How to run VM as a webserver

Post by scottgus1 »

satimis wrote:On LAN, local network, users can browse the websites running on browser;
Good. This means the network router can see the the guest as one of the LAN computers. Your guest is acting on the network as if it is a real computer attached to the network. There is nothing more in Virtualbox that you need to do.

Now you have to forward ports in the router to point at 192.168.0.111. This part is standard networking, which you can learn about with web-searching, and is beyond the scope of the Virtualbox forum.
satimis
Posts: 513
Joined: 12. Jun 2007, 03:41

Re: How to run VM as a webserver

Post by satimis »

scottgus1 wrote:........

Now you have to forward ports in the router to point at 192.168.0.111. This part is standard networking, which you can learn about with web-searching, and is beyond the scope of the Virtualbox forum.
Ok, I'll make some search on Internet. All cloned websites can be browsed on LAN without problem.

So far as I know. It is the DNS setting of the domain. I can set it pointing to the public IP address of my PC. But the VM is behind a router. This I couldn't resolve. It is the setting of routing.

Anyway lot of thanks for your advice.

Regards
Post Reply