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,
- Register domain names (in this example) www.earth.com and www.krypton.com (You may skip this step if you just testing)
- Point to the server's ip address.
- User types in either url into their browser which would send a request to Apache.
- Apache reads the request header (which contains the url) where the user wanted to go.
- 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 | ||
---|---|---|
| ||
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.
...