0

I have a domain I call Homenet.com and have two subdomains: wiki.homenet.com and intranet.homenet.com. For some reason, no matter what I type in it always shows content from intranet.homenet.com. My Virtual Host file is below:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

<VirtualHost *:80>
ServerName intranet.homenet.com
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
</VirtualHost>

<VirtualHost *:80>
ServerName wiki.homenet.com
    DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/wiki"
</VirtualHost>

I got it to work once on by browsing to wiki.homenet.com from the same server that was running both my DNS and Apache (Windows XP), but then I made a change and restarted Apache and it stopped working (even after I reversed the change). I've checked other anewsers on this board and my vhost file seems to be correct...just nothing it working. Any ideas? Thanks!

PS> I have a DNS server running that directs wiki.homenet.com and intranet.homenet.com to my Apache server. Apache and DNS both reside on the same server (192.168.1.149).

2 Answers 2

1

I wonder if you have UseCanonicalName set to on in your httpd.conf? That could be causing the problem. If UseCanonicalName is on, whatever value you have set for ServerName outside of your VirtualHost directives would be the one that is always used. See the Apache docs for more details.

1
  • Actually I just had to add a ServerAlias to my wiki.homenet.com VirtualHost entry and then shutdown Apache via Services.msc and kill it in Task Manager (wasn't shutting down correctly for some reason).
    – Tom
    Mar 6, 2011 at 7:54
0

Solve this one after a few hours of playing with it. My VirtualHost file now looks like the following

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName intranet.homenet.com
  ServerAlias intranet
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
</VirtualHost>

<VirtualHost *:80>
  ServerName wiki.homenet.com
  ServerAlias wiki
  DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/wiki"
</VirtualHost>

Also had to do a proper restart of Apache and my DNS to get everything working right. Now I can just type in wiki and it takes me straight into my MediaWiki

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .