views:

82

answers:

1

Hello all,

I am planning on getting a VPS soon and have two sites I want to host. I have my local vhosts setup for my development environment using host file to port it correctly.

My question is hopefully simple: When setting up with two separate domains that point to the one VPS server is Apache smart enough, like on the local environment, to automatically filter any requests for domain.com to the correct VHOST like it does locally? I would just like to be sure :)

Thanks!

Example of what I am asking:

Say Domain1.com and Domain2.com are both on my VPS.

When someone requests www.Domain1.com apache sees this and passes it through to the domain1.com vhost file. When someone requests www.Domain2.com apache sees this and passes it through to the domain2.com vhost file.

+4  A: 

The simple answer is 'yes', Apache is that clever. If you are used to using a local vhost file in conjunction with your hosts file to simulate local domains, the exact same technique can be applied on a VPS. The part you are doing with the hosts file is essentially creating a local name server, other than that Apache doesn't know the difference. Simply set the ServerName directive for each named vhost and you should find it working the same as it does locally.

Cags
Great! Thanks for confirming that for me.
Brad F Jacobs