Hosting multiple web servers on virtualbox

This is for discussing general topics about how to use VirtualBox.
Post Reply
Mahmoud Selman
Posts: 2
Joined: 24. Jan 2015, 20:36

Hosting multiple web servers on virtualbox

Post by Mahmoud Selman »

Is there a way to host multiple web servers running apache2 on Virtualbox guests on port 80?

Let's say I want to install apache2 on Server1 guest with Ubuntu OS and on Server2 guest with CentOs and access the websites running on the guests on port 80 from outside.

Now using bridge network setup won't work since I will be able to open port 80 only on one of the ips/guests and not both at same time from the router.

I tried with NAT port forwarding but that also won't work either since Virtualbox don't allow to open ports less than 1024.

Is there a way to make it work as VRDP way. To be able to open port 80 on the host and from there it redirect the visitors to the guest that are running that website.
Not proxy.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Hosting multiple web servers on virtualbox

Post by BillG »

Exactly what makes this a VirtualBox question? How is it any different from running a physical Ubuntu server with Apache on a network?

How would it be done on a physical machine?
Bill
Mahmoud Selman
Posts: 2
Joined: 24. Jan 2015, 20:36

Re: Hosting multiple web servers on virtualbox

Post by Mahmoud Selman »

BillG wrote:Exactly what makes this a VirtualBox question? How is it any different from running a physical Ubuntu server with Apache on a network?

How would it be done on a physical machine?
Please don't post if you don't know the answer. I don't want them to work as a network. I want each VM to be individual by using virtualbox network options if possible.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Hosting multiple web servers on virtualbox

Post by BillG »

And I am telling you that it has nothing to do with VirtualBox networking.
Bill
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: Hosting multiple web servers on virtualbox

Post by scottgus1 »

VRDP is the Virtualbox remote desktop server. It would allow you to see the guest screen, not interface with a website being served by the guest.

I would use Bridged for this setup, and have fixed IP addresses in each guest, if not the host as well for remote-administrative purposes. That way both the host and the guests all appear to the router and the outside world to be three separate computers on your internal network. Should be a lot less complicated to set up this way.

You can open ports in your network router to send services to each guest based on the guest's IP address. You will need to do research elsewhere as to how to get two different websites on two different IP addresses to be accessible behind one router, both using port 80. If you can't there may be a way to set up web addresses that include a different port number, so you can ask for mywebserver.com, which comes in on your internet IP address port 80, and myotherwebserver.com which comes in on your internet IP address port (some other number) Link (some other number) port to your other guest's port 80 in the router's port forwarding rules.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Hosting multiple web servers on virtualbox

Post by BillG »

Which is exactly how you would implement it on a physical network with physical machines. It does not use any special features of VirtualBox networking.
Bill
vbox_web_servers
Posts: 4
Joined: 27. Oct 2015, 22:21

Re: Hosting multiple web servers on virtualbox

Post by vbox_web_servers »

@Mahmoud Did you find a solution to your problem? I will be setting up the same configuration soon and would like to know if you achieved success without integrating a secondary router. I understand the problem because most routers, home and work, usually allow for a single IP to be routed to port 80. Once that port's activated, it can't be used for a second IP address.

Did you add a router to your setup, or maybe an L3 switch?
Post Reply