Apache Virtualhost entry with Windows hostname
Posted
by
gshauger
on Server Fault
See other posts from Server Fault
or by gshauger
Published on 2012-04-03T23:00:07Z
Indexed on
2012/04/03
23:31 UTC
Read the original article
Hit count: 208
I have a Windows Domain Controller and we use it for DNS for our internal network. I have an Ubuntu box with an IP address of 172.16.34.149. Within the Windows DNS I created the forward and reverse lookup entries for the name Endymion.
Naturally when ever I FTP/SSH/HTTP/etc to the hostname Endymion it resolves correctly to my Ubuntu box.
I wanted to do some web development on this box for an existing site. There were problems when I placed the website in a subfolder of /var/www/. Let's just say it was in folder /var/www/projectx/. The issue involved the incorrect resolution of non-relative urls.
So I figure I could create a new DNS entry for the hostname projectx. Sure enough when I FTP/SSH/HTTP/etc to the hostname projectx it takes me to the same ubuntu box as the hostname Endymion...this is what I would expect. I now have two hostnames for the same box.
I then create a Virtualhost entry in httpd.conf that looks like the following:
<VirtualHost *:80>
DocumentRoot /var/www/projectx
ServerName projectx
ServerAlias projectx
</VirtualHost>
Sure enough when I go to a browser and type in http://projectx/ it takes me to the correct subfolder. Everything works!!!
Not so fast.
I then go to http://endymion/ and instead of taking me to /var/www/ it takes me to /var/www/projectx/
Clearly I'm missing something. Help please! ;)
© Server Fault or respective owner