.comment-link {margin-left:.6em;} <$BlogRSDUrl$>

Saturday, February 24, 2007

Virtual Reality 

I consider myself moderately adept at setting up and using the Apache HTTPD server. There's just not a whole lot to it. However, one thing has plagued me, mocking me as if to say "You'll never get me!" This is the concept of virtual hosts.

Virtual hosts provide a way for a web server to host more than one site from a single machine. It also makes it possible to do this without having a gazillion network interface cards. It's really a cool concept that I wish I could figure out. I know I'm close, but there's something I'm missing.

To start out, I have to first set up virtual network interfaces based on my installed interface eth0. I do this by entering the follow set of commands:

ifconfig eth0:1 123.45.67.8
route add -host 123.45.67.8 dev eth0:1

At this point, I can ping that IP address on my network and it will respond. Of course, I'm not using address 123.45.67.8. That is only for demonstration purposes. The real address I'm assigning to eth0:1 is 192.168.1.17, which is convenient for my network setup.

After setting up the virtual network interface, I then modify the httpd.conf file to include the virtual host's address, which is 192.168.1.17. Then, I restart the web server. All is well. There are no errors or anything up to that point.

When I go out to a browser and try browsing my newly-created virtual address, it simply routes me back to the original site stored on the machine. So, my Schillclan site now has two names that refer to it, and the new domain name doesn't get to it's intended document root. That's the problem I am having.

Just thought I'd let everyone out there know about it.

Comments: Post a Comment


This page is powered by Blogger. Isn't yours?