You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Shelley Waltz <sh...@cabm.rutgers.edu> on 2007/05/17 16:01:03 UTC

[users@httpd] Virtual Host Configuration

I am trying to find the best solution to this issue.
I have two apache servers hosting virtual domains 
both in the same domain.

The first server hosts a virtual domain for webmail
and is also the smtp and imap server.  The DNS A record
for this host points to the domain and a CNAME record
references the address as webmail ...
	A             mydomain.edu
	CNAME webmail.mydomain.edu


The apache server virtual host is 
ServerName webmail.mydomain.edu


My second webserver has various virtual domains as well as 
the default www.mydomain.edu.

Now what I would like to do is be able to set up a 
default virtual domain on webserver two which will
answer inquieres to mydomain.edu.  Therefore webserver
one needs to redirect inquieres to mydomain.edu to
www.mydomain.edu.

Currently such inquires end up at webserver one and
the webmail page.  If I set up a default virtual host
on webserver one as
ServerName mydomain.edu, then all inquieres including
the ones for webmail.mydomain.edu go there.  Why is this?
ServerName webmail.mydomain.edu follows the default virtual 
host.

Is there a simpler way to accomplish this without changing
the DNS records?  Suggestions are appreciated.

S.Waltz





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


Re: [users@httpd] Virtual Host Configuration

Posted by Shelley Waltz <sh...@cabm.rutgers.edu>.
Joshua,
Thanks very much - that WAS it!
S

On Thu, 17 May 2007, Joshua Slive wrote:

   On 5/17/07, Shelley Waltz <sh...@cabm.rutgers.edu> wrote:
   
   > # Use name-based virtual hosting.
   > #
   > NameVirtualHost *:80
   >
   >
   > <Virtualhost *>
   
   This needs to match the NameVirtualHost, so use <VirtualHost *:80>.
   
   Joshua.
   
   ---------------------------------------------------------------------
   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
   
   


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


Re: [users@httpd] Virtual Host Configuration

Posted by Joshua Slive <jo...@slive.ca>.
On 5/17/07, Shelley Waltz <sh...@cabm.rutgers.edu> wrote:

> # Use name-based virtual hosting.
> #
> NameVirtualHost *:80
>
>
> <Virtualhost *>

This needs to match the NameVirtualHost, so use <VirtualHost *:80>.

Joshua.

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


Re: [users@httpd] Virtual Host Configuration

Posted by Shelley Waltz <sh...@cabm.rutgers.edu>.
Some clarifications.  I did not use a _default_ in the
virtual hosts, I am assuming the first virtualhost will
pick up any quieres not satisfied by the other virtual hosts.

Secondly, DNS has two A records
mydomain.edu
webmail.mydomain.edu
are the same ip 

Here is part of the httpd.conf ...

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80


<Virtualhost *>
     DocumentRoot /var/www
     ServerName mydomain.edu
     <Directory "/var/www">
        Order allow,deny
        Allow from all
     </Directory>
</VirtualHost>

# WebMail

<Virtualhost *>
     DocumentRoot /var/www/webmail
     ServerName webmail.mydomain.edu
     <Directory "/var/www/webmail">
        Order allow,deny
        Allow from all
     </Directory>
</VirtualHost>


As mentioned, when I include the above first virtualdomain for 
mydomain.edu, all quieres including those to webmail.mydomain.edu
end up at the first virtual server.  

thanks S

On Thu, 17 May 2007, Joshua Slive wrote:

   On 5/17/07, Shelley Waltz <sh...@cabm.rutgers.edu> wrote:
   
   > Currently such inquires end up at webserver one and
   > the webmail page.  If I set up a default virtual host
   > on webserver one as
   > ServerName mydomain.edu, then all inquieres including
   > the ones for webmail.mydomain.edu go there.  Why is this?
   > ServerName webmail.mydomain.edu follows the default virtual
   > host.
   
   Sounds like you didn't setup vhosts correctly, but it would certainly
   help if you showed us the relevant part of the configuration so we
   could try to identify the mistake.
   
   Remember that when using name-based virtual hosts, you should never
   use a <VirtualHost _default_>. Instead, the first listed name-based
   virtual host is automatically the default.
   
   Joshua.
   
   ---------------------------------------------------------------------
   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
   
   


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


Re: [users@httpd] Virtual Host Configuration

Posted by Joshua Slive <jo...@slive.ca>.
On 5/17/07, Shelley Waltz <sh...@cabm.rutgers.edu> wrote:

> Currently such inquires end up at webserver one and
> the webmail page.  If I set up a default virtual host
> on webserver one as
> ServerName mydomain.edu, then all inquieres including
> the ones for webmail.mydomain.edu go there.  Why is this?
> ServerName webmail.mydomain.edu follows the default virtual
> host.

Sounds like you didn't setup vhosts correctly, but it would certainly
help if you showed us the relevant part of the configuration so we
could try to identify the mistake.

Remember that when using name-based virtual hosts, you should never
use a <VirtualHost _default_>. Instead, the first listed name-based
virtual host is automatically the default.

Joshua.

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