Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: name based Virtual Hosts problem |
|
Author |
|
knotty69au
Joined: 29 Apr 2007 Posts: 1
|
Posted: Sun 29 Apr '07 1:50 Post subject: name based Virtual Hosts problem |
|
|
Hi all ,
I hope Someone can help me with this problem. I am setting up a apache2 server to serve pages for two personal websites. I only have one IP available and so want to use Host headers. I have the following in my httpd.conf -
Code: |
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/lopbunnies
ServerName *.lopbunnies.hobby-site.com
<Directory "/var/www/lopbunnies">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/knottyweb
ServerName *.knotty.homeip.net
<Directory "/var/www/knottyweb">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
|
the trouble is that the server is serving pages from /var/www/lopbunnies whether the url is www.knotty.homeip.net or www.lopbunnies.hobby-site.com
I've been over this a few times and I have no idea what I am doing wrong. I am attempting to migrate from IIS to apache
Thanks
Knotty |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Sun 29 Apr '07 4:40 Post subject: |
|
|
The ServerName directive doesn't use asterisk for wildcard server names.
You should use:
If the same site has additional names, you can use ServerAlias to list them all individually.
For example:
ServerAlias should be used in addition to a ServerName directive, although you currently can get away with omitting the ServerName directive entirely.
If you really need to, you can use an asterisk in the ServerAlias directive. Code: | ServerAlias *.knotty.homeip.net |
-tom- |
|
Back to top |
|
|
|
|
|
|