httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Whitson <ja...@visionxtreme.net>
Subject Re: [users@httpd] Virtual Hosts Help
Date Thu, 24 Jun 2004 01:05:36 GMT
Hi Jacob,

A quick look at the documentation would really help, because this is 
pretty basic.

Try this, with your specific names and IP's:

NameVirtualHost 10.2.5.20

###### mydomain.com
<VirtualHost 10.2.5.20>
	DocumentRoot /var/www/html/mydomain.com
	ServerAdmin admin@mydomain.com
	ServerName www.mydomain.com
	ServerAlias mydomain.com
</VirtualHost>

The server alias will handle a request for http://mydomain.com, and the 
ServerName will handle a request for http://www.mydomain.com

If you want to add subdomains like 'foobar' it looks the same:

###### foobar.mydomain.com
<VirtualHost 10.2.5.20>
	DocumentRoot /var/www/html/foobar.mydomain.com
	ServerAdmin admin@mydomain.com
	ServerName foobar.mydomain.com
</VirtualHost>

No need for a ServerAlias her because it only answers to one name, 
foober.mydomain.com. As long as you have a DNS entry like this:

foobar.mydomain.com.	IN	A	10.2.5.20

That should handle you. If you want to add more subdomains, just repeat 
the foobar.mydomain.com VirtualHost config above.

- Jason


jacob bager wrote:

> Hello
>  
> i need a little help here. How do i set up the following ?
>  
> I have a server @ <mydomain.com>
>  
> as it is now . www.mydomain.com <http://www.mydomain.com> will give my 
> primary site.
>  
> i would like to have foobar.mydomain.com to give another site. ..
> and barfor.mydomain.com to give yet another site....
>  
> i'd tried it with
>  
> <VirtualHost 0.0.0.0:80>
>        ServerName www.mydomain.com <http://www.mydomain.com>
>        DocumentRoot /somepath/primary/
> </VirtualHost>
>  
> <VirtualHost 0.0.0.0:80>
>        ServerName www.foobar.mydomain.com <http://www.foobar.mydomain.com>
>         ServerAlias foobar._mydomain.com_
>        DocumentRoot /somepath/foobarsite/
> </VirtualHost>
> After restart the only site i can get is the foobar site.
>  
> What did i do wrong ?
>  
> not setting <NameVirtualHost *:80>
>  
> i have the www.mydomain.com <http://www.mydomain.com> and mydomain.com  
> registred in the DNS .
> To my knowledge that should be enough right ?
>  
> Please Help
> Jacob Bager
> jb@sur-mokka.dk <mailto:jb@sur-mokka.dk>
>  
>  
>  
>  
>  
>  

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message