httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "R. Simons" <robcl...@yahoo.com>
Subject Re: [users@httpd] Apache2 Configuring Virtual Servers/Hosts
Date Mon, 03 Jan 2005 04:10:43 GMT
Update 

After reading additional posts, it looks like the
NameVirtualHost and VirtualHost must match.

example:

If NameVirtualHost is defined as *:80, then
VirtualHost must be <VirtualHost *:80>

or

If NameVirtualHost is defined as 192.168.0.15, then
VirtualHost must be <VirtualHost 192.168.0.15>

--- "R. Simons" <robclt63@yahoo.com> wrote:

> Hi All,
> 
> After spending a lot of effort trying to get virtual
> servers working on a SuSE's SLES9 server, I am
> posting
> this in hopes of saving others the time.  Maybe I
> have
> missed something in the documentation, but the
> following configurations was the only way I could
> get
> it to work.  I took a LAN trace, and I could see the
> client was making request for the correct domain. 
> But
> I was always seeing the first virtual server's web
> page.
> 
> There was 2 things I had add/modify.
> 
> 1) Create a conf file in the directory
> /etc/apache2/vhost.d/ that has nothing but the
> NameVirtualHost directive.
> 
> 2) Changed <VirtualHost *:80> to <VirtualHost
> 192.168.0.15>.  This section created interesting
> results depending what values I used.
> 
> Examples of failed configs
> 
> <VirtualHost *:80>
> Results after doing "rcapache2 restart":
> test:/etc/apache2/vhosts.d # rcapache2 restart
> [Sun Jan 02 16:31:49 2005] [warn] _default_
> VirtualHost overlap on port 80, the first has
> precedence
> Syntax OK
> Shutting down httpd2 (waiting for all children to
> terminate)         done
> Starting httpd2 (prefork) [Sun Jan 02 16:31:49 2005]
> [warn] _default_ VirtualHost overlap on port 80, the
> first has precedence
>                                                     
>  
>               done
> 
> 
> <VirtualHost *>
> Results after doing "rcapache2 restart":
> test:/etc/apache2/vhosts.d # rcapache2 restart
> Syntax OK
> Shutting down httpd2 (waiting for all children to
> terminate)         done
> Starting httpd2 (prefork)                           
>  
>               done
> 
> 
> <VirtualHost 192.168.0.15>
> Results after doing "rcapache2 restart":
> test:/etc/apache2/vhosts.d # rcapache2 restart
> [Sun Jan 02 15:09:05 2005] [warn] VirtualHost
> 192.168.0.15:0 overlaps with VirtualHost
> 192.168.0.15:0, the first has precedence, perhaps
> you
> need a NameVirtualHost directive
> Syntax OK
> Shutting down httpd2 (waiting for all children to
> terminate)         done
> Starting httpd2 (prefork) [Sun Jan 02 15:09:06 2005]
> [warn] VirtualHost 192.168.0.15:0 overlaps with
> VirtualHost 192.168.0.15:0, the first has
> precedence,
> perhaps you need a NameVirtualHost directive
>                                                     
>  
>               done
> 
> 
> <VirtualHost www.c1thecat.com> and <VirtualHost
> www.k2thecat.com>
> Results after doing "rcapache2 restart":
> test:/etc/apache2/vhosts.d # rcapache2 restart
> [Sun Jan 02 14:59:39 2005] [warn] VirtualHost
> www.c1thecat.com:0 overlaps with VirtualHost
> www.k2thecat.com:0, the first has precedence,
> perhaps
> you need a NameVirtualHost directive
> Syntax OK
> Shutting down httpd2 (waiting for all children to
> terminate)         done
> Starting httpd2 (prefork) [Sun Jan 02 14:59:39 2005]
> [warn] VirtualHost www.c1thecat.com:0 overlaps with
> VirtualHost www.k2thecat.com:0, the first has
> precedence, perhaps you need a NameVirtualHost
> directive
>                                                     
>  
>               done
> 
> 
> Here is my working configuration.
> 
> 
> Apache2 Version:
> test:~ # rpm -q apache2
> apache2-2.0.49-27.8
> 
> 
> My conf files:
> test:/etc/apache2/vhosts.d # ls
> .
> ..
> c1thecat-vhost.conf ...	First Domain
> k2thecat-vhost.conf ...	Second Domain
> namevhost.conf	.......	My NameVirtualHost directive
> conf file
> vhost-ssl.template
> vhost.template
> 
> 
> Contents of namevhost.conf:
> test:/etc/apache2/vhosts.d # cat namevhost.conf
> NameVirtualHost 192.168.0.15
> 
> 
> Contents of c1thecat-vhost.conf:
> test:/etc/apache2/vhosts.d # cat c1thecat-vhost.conf
> <VirtualHost 192.168.0.15>
>     ServerAdmin webmaster@c1thecat.com 
>     ServerName www.c1thecat.com 
>     DocumentRoot /srv/www/vhosts/c1thecat.com
>     ErrorLog /var/log/apache2/c1thecat.com-error_log
>     CustomLog
> /var/log/apache2/c1thecat.com-access_log
> combined
> 
>     # don't loose time with IP address lookups
>     HostnameLookups Off
> 
>     # needed for named virtual hosts
>     UseCanonicalName Off
> 
>     # configures the footer on server-generated
> documents
>     ServerSignature On
> 
>     ScriptAlias /cgi-bin/
> "/srv/www/vhosts/c1thecat.com/cgi-bin/"
> 
>     <Directory
> "/srv/www/vhosts/c1thecat.com/cgi-bin">
>         AllowOverride None
>         Options +ExecCGI -Includes
>         Order allow,deny
>         Allow from all
>     </Directory>
> 
>     <IfModule mod_userdir.c>
>         UserDir public_html
>         Include /etc/apache2/mod_userdir.conf
>     </IfModule>
> 
>     <Directory "/srv/www/vhosts/c1thecat.com">
>         Options Indexes FollowSymLinks
>         AllowOverride None
>         Order allow,deny
>         Allow from all
>     </Directory>
> 
> </VirtualHost>
> 
> 
> Contents of k2thecat-vhost.conf:
> test:/etc/apache2/vhosts.d # cat k2thecat-vhost.conf
> <VirtualHost 192.168.0.15>
>     ServerAdmin webmaster@.k2thecat.com 
>     ServerName www.k2thecat.com 
>     DocumentRoot /srv/www/vhosts/k2thecat.com
>     ErrorLog /var/log/apache2/k2thecat.com-error_log
>     CustomLog
> /var/log/apache2/k2thecat.com-access_log
> combined
> 
>     # don't loose time with IP address lookups
>     HostnameLookups Off
> 
>     # needed for named virtual hosts
>     UseCanonicalName Off
> 
>     # configures the footer on server-generated
> documents
>     ServerSignature On
> 
>     ScriptAlias /cgi-bin/
> "/srv/www/vhosts/k2thecat.com/cgi-bin/"
> 
>     <Directory
> "/srv/www/vhosts/k2thecat.com/cgi-bin">
>         AllowOverride None
>         Options +ExecCGI -Includes
>         Order allow,deny
>         Allow from all
> 
=== message truncated ===



		
__________________________________ 
Do you Yahoo!? 
Send a seasonal email greeting and help others. Do good. 
http://celebrity.mail.yahoo.com

---------------------------------------------------------------------
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