Thursday, September 07, 2006

VirtualHost with ServerAlias

I was setting up VirtualHost for my Apache server with ServerAlias, as shown below:

<virtualhost *:80>
ServerAlias, *
DocumentRoot /path/to/directory
This was the first time I was playing with VirtualHost configuration and ServerAlias, I got working but or were not working.

I realized I had missed one step which was stated in the documentation:
"Of course, you can't just make up names and place them in ServerName or ServerAlias. You must first have your DNS server properly configured to map those names to an IP address associated with your server."

DNS Mapping for the subdomain's was the problem. I noticed, DNS mapping was done for myserver in com domain something like this:

mysever IN A 192.168.0.XX

but there was no mapping for my subdomain's. I added a CNAME record in the DNS, something like this

*.myserver IN CNAME myserver
[Please refer to documentaion for adding CNAME DNS entry, it might vary. ]

Once I updated my DNS Server, the ServerAlias started to work.

Few of the DNS Servers I tried: Posadis, BIND .

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