Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

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 (in this example) www.earth.com and  www.krypton.com (You may skip this step if you just testing)
  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.

...

Note

There is another approach to this (provided most virtual hosts have the same requirements) where virtual hosts are created through mod rewrite, convention and customization is acheived achieved using .htaccess or <Directory>.

...

Code Block
languagebash
tpham@krypton:/etc/apache2$ find . -type f | xargs grep -i listen
./ports.conf:Listen 80
./ports.conf:    Listen 443
tpham@krypton:/etc/apache2$ find . -type f | xargs grep -i namevirtualhost
./ports.conf:NameVirtualHost *:80
./ports.conf:    # NameVirtualHost statement here
tpham@krypton:/etc/apache2$

Testing

Without Real Domain Names

... host file ... Roderick will fill in the details.

With Real Domain Names

... put steps on verifying domain name points to proper ip, also link to article on how to setup DNS... Roderick to fill in.

Next

There's much more to Apache than this. For example, we could set up public and private Online Shares. If you are serving real traffic you might want to read the next step about configuring logging. If you are just playing around then you can skip to setting up an application server.

...