- 1 Red Hat Enterprise Linux 7.2 Enters Beta with Improved Container Support
- 2 VMware CEO Pat Gelsinger Gives VMworld 5 Imperatives for Success
- 3 VMware vSphere Integrated Containers Previewed at VMworld
- 4 Worldwide Server Revenues Top $13.5 Billion in 2Q15
- 5 Blue Box OpenStack Lands on IBM Softlayer Servers
Apache Guide: Setting Up Virtual Hosts
As suggested in the paragraph above, virtual hosts are Web sites with different names that all run on the same server hardware. The idea is that Apache knows which site you are trying to get, even though they are all on the same server, and gives you content from the right one.Need to make a single DSL connection look like a colocation facility? Then you'll want to look at setting up virtual hosts -- Web sites with different names that all run on the same server hardware. Rich Bowen explains three different methods of setting up virtual hosts on your Apache server.
It's this trick that lets me run several Web sites on my home machine, from a variety of different domain names, and several names within one domain, so that my one little machine behind my DSL link looks like a room full of servers. Neat trick.
Well, you probably already have some ideas in mind. But here's how I generally use virtual hosts. I work for a Web-design company, and when we're developing a customer site, we set up a virtual host specially for that company. These are usually name-based, since these are faster to set up (one step shorter), and are almost always internal only. That is, the names are put into our internal DNS, so that internal hosts can see the Web sites, but external browsers see only the boring, featureless external page on our development server.
The advantages to doing this are numerous. It lets us set the directory structure on the site the same way that it will be on the real server when we are done with development. It lets us keep fines completely separate from one "server" and another, so that there is no confusion as to what is on which site. And, from the developers' perspective, it lets them set up completely different sites in DreamWeaver, rather than just different subdirectories on the same site.
And, of course, you don't have to have a new server for each site, no matter how many customer projects you're working on at one time. Which is the biggest reason for using virtual hosts in any scenario.
Virtual hosts can be specified one of two ways. These are configuration differences on the server, and are not visible to the client--that is, there is no way that the user can tell what sort of virtual host they are using. Or even that they are using a virtual host, for that matter.
The two types are IP-based virtual hosting and name-based virtual hosting. In a nutshell, the difference is that IP-based virtual hosts have a different IP address for each virtual host, while name-based virtual hosts have the same IP address, but use different names for each one. There are reasons for each. There's not much difference in implementation.
In IP-based virtual hosting, you are running more than one web site on the same server machine, but each web site has its own IP address. In order to do this, you have to first tell your operating system about the multiple IP addresses. Most modern operating systems let you give your machine as many IP addresses as you want. The specific details of how you give your machine multiple IP addresses varies from OS to OS, and I'm not going to go into that right now. If you don't know how to accomplish this on your OS, you might want to consult your local guru. It's typically not very difficult. Or, you may just want to skip down to the section on name-based virtual hosts.
On older operating systems, it was sometimes even necessary to have one NIC (network interface card) per IP address, but that is almost never the case any more.