logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

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.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: name based Virtual Hosts problem
Author
knotty69au



Joined: 29 Apr 2007
Posts: 1

PostPosted: Sun 29 Apr '07 1:50    Post subject: name based Virtual Hosts problem Reply with quote

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 Smile


Thanks

Knotty
Back to top
tdonovan
Moderator


Joined: 17 Dec 2005
Posts: 611
Location: Milford, MA, USA

PostPosted: Sun 29 Apr '07 4:40    Post subject: Reply with quote

The ServerName directive doesn't use asterisk for wildcard server names.

You should use:
Code:
ServerName www.knotty.homeip.net

If the same site has additional names, you can use ServerAlias to list them all individually.
For example:
Code:
ServerAlias knotty.homeip.net www.homeip.net homeip.net knotty


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


Reply to topic   Topic: name based Virtual Hosts problem View previous topic :: View next topic
Post new topic   Forum Index -> Apache