0

I am currently running a physical Ubuntu 14.04 server that hosts a website. I want to add a second website, but I don't want to try and run both from one physical box. I also want to separate my data a little, such as the main website from a WordPress blog at a subdomain.

From what I've been able to research and figure out it seems like having a host machine run multiple virtual servers is what I want, but I'm not sure how to get there. How can I run multiple servers from my one physical server? And how can I have those accessible to the internet?

EDIT: I'm running a virtual Ubuntu 14.04 server from a Ubuntu desktop using Oracle VirtualBox. How am I able to point my domain name to this virtual server and access the website?

3
  • 1
    You have several options ranging from Virtual Hosts on your current server to Docker and Virtualization. You'll need to do a bit of research on which solution you'd like to use and come back with some more specific questions.
    – heavyd
    Feb 18, 2016 at 0:01
  • Setup a single server on a VM, then repeat that process, then make each visible to each other
    – Ramhound
    Feb 18, 2016 at 0:08
  • What do you mean make them visible to each other? That's the part that I can't figure out, how to make the virtual server visible outside of the host box.
    – BFrisch
    Feb 18, 2016 at 0:34

1 Answer 1

0

I think there's a few concepts in play here - firstly, you can typically only have one application on a port per IP address. There's some software that can handle passing stuff to other servers as well.

So lets start at the beginning

At the simplest your topography looks like this

Internet+-----------> consumer router +----------> Host+--------------> VM

You need a routable IP address (not a NAT) one for your internet connection, and typically you can check this at your router. Point your ipv4 A record at this.

You have two options on how you set up your host and VM - a NAT (which means you need to forward ports from your hosts to your VM) or 'bridged' where your VM acts as a seperate physical machine. I prefer bridged.

If you go for NAT for your VMs, you need to port forward twice - from your router to your host and from your host to your VM.

If you want do it as a bridged network, you simply need to forward the port you want to use to your VM.

Typically webservers use port 80, but sometimes that port gets blocked.

Now for 2 web servers it gets complicated. The best way (maybe only way) to have two seperated webservers is to have a third server, running as a proxy

ngnix is the popular option for this - this serverfault question covers the process, but basically your third server sits there passing traffic to the right server based off the domain name. This uses virtualhosts, and ngnix working pretty efficiently as a reverse proxy.

You could also set up two virtualhosts with different root directories (and one web server). You wouldn't necessarily have to share databases (which could be on their own VMs). This would be the smart way to do it.

2
  • Thank you! This helped me greatly, and even answered questions that I hadn't started to tackle yet.
    – BFrisch
    Feb 19, 2016 at 1:24
  • Reading into the question - I figured as much. There's something to be said for having somewhat over a decade of experience futzing around in the dark and essentially this covers a good chunk of the things I've done, other than the reverse proxy server.
    – Journeyman Geek
    Feb 19, 2016 at 2:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .