Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

What is Virtual Hosting?

Virtual hosting configures Apache to be able to host more than one website on the same computer. As an example, let's say this Apache Web Server will host both www.earth.com and www.krypton.com. Here is how the process works,

  1. Register domain names www.earth.com and  www.krypton.com
  2. Point to the server's ip address.
  3. User types in either url into their browser which would send a request to Apache.
  4. Apache reads the request header (which contains the url) where the user wanted to go.
  5. Based on the url, apache checks for a matching virtual host entry and directs the user to that virtual server's home directory.

In the future, I will put a diagram to illustrate.

Apache Differences on Ubuntu

Ubuntu/Debian organizes things slightly different than other systems when it comes to Apache. If you read other website that talk about Apache you might get confused. So here's how Ubuntu does things. You have the following key files,

/etc/apache2/apache2.conf - this is the default file provided during install and contains the default settings. If possible do not modify this file.
/etc/apache2/httpd.conf - location for global user configured options.
/etc/apache2/site-available/* - this is where you store your different virtual hosts.
/etc/apache2/sites-enabled/* - symbolic links here used to enable sites from site-available.
 
This is enough to get us started, but feel free to read more details at Control-Escape.

Traditional Name Based Virtual Hosting

There are so many different ways of doing this it's quite mind boggling. Here's my overall approach:

  • I want clients to come in and manage the pure html aspects of their website, so each website will have it's own group and clients will belong to the website's group.
  • Logging will be Virtual Host Based Logging. The pros and cons are are discussed in Apache Log Management.
  • Each virtual host will also have a,
    • browse-able "shared" folder to easily distribute files
    • "shared.private' where .htaccess is enabled so users can set their own authentication parameters and indexing

Create Virtual Host Files

Looking in /etc/apache2/apache2.conf you will see a reference to the directory, /etc/apache2/sites-enabled/. Apache will look in this directory and load any virtual host file configurations.

This article is still being transitioned from my old google wiki.

  • No labels