What is a virtual host? relating to web servers

371 views

I understand the basic premise of web servers, but have never quite wrapped my head around what the hell a virtual host is or means, please ELI5!

In: 2

7 Answers

Anonymous 0 Comments

A host is a server (or group of servers) where a website is stored. When you browse to a website you connect to that host (using the domain name such as Reddit.com or less common the IP address) and request the various files. The host sends the necessary files over the connection.

A virtual host is when multiple websites with different domain names are stored on the same server. This is called virtual hosting or shared hosting. It’s cheaper because you are using less resources, but it limits how much traffic your website can handle as a result. It’s suitable for small, not too popular website but not for large, complicated, and or popular ones.

Anonymous 0 Comments

It’s a way of hosting multiple domains on the same machine. So for instance alice.com, bob.com and carol.com may be completely different pages, but located on the same machine, on the same public IP address. Which site you see depends on what domain you came from.

For Apache for instance you can configure it in such a way that all 3 sites have files in different paths, have their own separate logs and are configured differently.

Anonymous 0 Comments

so have you ever heard of a virtual machine?
where you emulate a desktop machine, using software on a desktop machine? maybe you want to try a video game hat might be a virus. if the virtual machine gets the virus, you delete the virtual machine, and learn your lesson safely.

its kind of like that, if you look up IAAS (Infrastructure as a service) it will go into more detail.

but basically you have a server pretending to be a server that is just a copy embedded in itself.

your next question, im guessing is “why”

good question!

if a server is pretend or virtualized then it will take damage during attacks without harming the actual hardware(the actual real physical host). so you have a web site hosted on a virtual host, then your website gets hacked, the host doesnt get hacked we will call them “Host-R-Us”. Hosts-r-us is fine, and they can continue to provide services to other clients who maybe made more effort to secure their apps or services.

also, it separates your website from the other clients for several reasons.

1. cost – if your web site gets 100 visits a day, and only need a 1 core processor, and 4 GB of ram, then you dont pay for Hosts-r-us’ entire 16 core/ 64G server. you only pay for what you use. and other people pay for what they use.
2. security – heaven forbid someone that uses Hosts-r-Us is a malicious actor. they might try and steal data from other folks on the service. but if the only environment they can see is a small virtual infrastructure, then they cant even access your data, and your clients are safe from that threat. then, o-lordy, the proud boys were using the same service,(not the gay proud boys, the terrorist proud boys) and all of their data is being subpoenaed for the Jan 6 trials. your data was entirely separate. so you dont have to give up your data, or go to court and waste time and money getting caught in the crossfire. neither does hosts-r-us, they just export the entire virtual environment into a nice clean package, upload it to a storage blob, then send the link to the lawyers in question. no muss, no fuss, no liability…
3. IT is fun!

Anonymous 0 Comments

OK, let’s say you have a physical computer sitting in your office that’s your company’s web server. It’s connected to the Internet and anytime someone visits your website, that computer is powering it. That’s not ideal because if your office building loses power or loses Internet, your site goes down.

A better solution is to have someone else host it for you. You can rent a real physical computer in someone else’s data center. You install your own software on it, and they take care of ensuring it has continuous power, and multiple redundant connections to the Internet.

But, physical computers don’t last forever. The hard drive eventually dies, the fan wears out, etc. – which means your site would go down until you get a replacement.

So the solution to that is a virtual server. Basically you provide a virtual machine image, and the data center runs your virtual machine using software like VMWare. What’s great about that is that now you don’t know or care what physical machine it’s running on! If that computer dies, they can just start up your virtual machine on some other computer and you’re back up and running within minutes.

It also means upgrades are trivial! Do you need more RAM? They can just stop your virtual machine on one computer and start it on another machine with twice as much RAM. Instead of 30 minutes of downtime, you’re back up and running with twice the RAM in literally seconds.

So that’s it. It’s just a virtual machine with your own server software running on it, in some other data center.

Anonymous 0 Comments

Each web server will generally be accessible by only a single IP address, so before virtual hosts, you’d need an IP per website, which, if you were hosting a few different sites from a single point would start to get expensive, as you’d need to pay for additional addresses.

So virtual hosts were designed, meaning you could host multiple sites on a single IP address. Prior to virtual hosts, your browser would connect to the server and ask for the appropriate page, and there’d only be a single site there meaning you’d get the page you expected.

With the advent of virtual hosts, your browser now needs to connect to the server, and tell the server which website it wants to get a page from, and then which page it wants.

The web server will generally be set up with a default website so if for some reason the browser doesn’t specify a hostname, it will serve the appropriately requested page from the default setup.

Anonymous 0 Comments

It means that instead of your own metal box to run a web-server on your just get a piece of software that pretends to be a metal box.

This technique called virtualization has a number of benefits. You can have one actual physical computer pretend to be several virtual ones and the software running on those virtual computers will all think they have a physical computer to themselves.

This is cheaper since instead of having to buy one physical server and using it for one thing or renting it out once, you can rent the same physical box out to different people simultaneously.

Soft of like a time-share home, but instead of every part owner having it for a few days a year, it switches back and forth many, many times a second and each individual doesn’t even notice that they are sharing most of the time.

This sort of virtualization also has a lot of other benefits such as a much easier time of adding resources to virtual hosts.

It also allows for the virtual computer to be easily moved back and forth between different physical computers while it is running without anyone noticing.

The creates a sort of flexibility that you wouldn’t have with physical boxes.

Anonymous 0 Comments

Originally HTTP was designed with the assumption that every domain has its own IP address.

Meaning if you want to host multiple websites on a single machine, you needed to give that machine multiple IP addresses (or you can workaround by putting one of them on a different port, but this was not common for user-facing websites, as you’d have to put the port in the URL like this: http://example.com:9731 ).

In HTTP/1.1 they made it mandatory for clients to send a “Host:” header with the domain you’re asking for. This solves the problem and lets you run multiple websites, as the web server can see “Host: www.example.com” and do something different than “Host: www.myothersite.com”

HTTP/1.1 was released in 1997, so at this point every HTTP client has supported it for decades.