Help in setting up one http server for two different domains

Les Mikesell lesmikesell at gmail.com
Sat Dec 3 02:32:29 UTC 2005


On Fri, 2005-12-02 at 19:29, CodeHeads wrote:
> Jim Christiansen wrote:
> > Hello,  I've got a server that is currently serving one website with a 
> > registered domain and dns.  I would like to use the same server to also 
> > serve another domain.  Reading about name-based virtual hosting at 
> > http://httpd.apache.org/docs/1.3/vhosts/name-based.html I can't seem to 
> > get the second url to load- I keep getting the same first domain's 
> > webpage.  The path for the first domain is from /var/www/html.  The path 
> > for the second domain is set right now to  /var/www/html/seconddomain...
> > 
> > So anywhoooo...  Comments???
> > 
> > Thanks,
> > 
> > Jim
> > 
> > 
> This is how I would do it.
> Main domain would be setup at /var/www/html/firstdomain
> and the second /var/www/html/seconddomain
> 
> <VirtualHost *:80>
> 	ServerAdmin email at email.com
> 	DocumentRoot /var/www/html/firstdomain
> 	ServerName firstdomain.com
> 	ServerAlias www.firstdomain.com
> 	ErrorLog logs/firstdomain-error_log
> 	CustomLog logs/firstdomain-access_log common
> </VirtualHost>
> 
> <VirtualHost *:80>
> 	ServerAdmin email at email.com
> 	DocumentRoot /var/www/html/seconddomain
> 	ServerName seconddomain.com
> 	ServerAlias www.firstdomain.com
> 	ErrorLog logs/seconddomain-error_log
> 	CustomLog logs/seconddomain-access_log common
> </VirtualHost>
> 
> Hope this helps

Note that you need a:
NameVirtualHost *:80
in the global section above those to make it work.  (And
fix the typo in the second ServerAlias).  Also you can
add additional names in the ServerAlias entry if you want.

--
  Les Mikesell
    lesmikesell at gmail.com





More information about the fedora-list mailing list