Networking Forums  

Go Back   Networking Forums > Networking Newsgroups > Linux Networking

apache viurtual hosts

Reply
 
Thread Tools Display Modes
  #1  
Old 11-25-2004, 12:09 PM
Default apache viurtual hosts



Hi!


I run a (new) webserver, and have recently tried to add subdomains via
the Virtual Hosts directive in the httpd.conf file.

I want to have a subdomain mail.server.com. To di so I have made the
following modifications in httpd.conf:

<VirtualHost 192.168.1.2:80>
ServerAdmin (E-Mail Removed)
DocumentRoot /www/mail
ServerName mail.server.com
ErrorLog /var/log/apache/mail_error_log
CustomLog /var/log/apache/mail_error_log common
</VirtualHost>

192.168.1.2 is the fix IP of my server within the network.

IT worked, when trying mail.server.com the page from /ww/mail was
displayed. But www.server.com also pointed to mail.server.com.

Then I tried to add www explicitly:

NameVirtualHost www.server.com
<VirtualHost 192.168.1.33:80>
ServerAdmin (E-Mail Removed)
DocumentRoot /www/
ServerName server.com
ServerAlias www.server.com
ErrorLog /var/log/apache/mail_error_log
CustomLog /var/log/apache/mail_error_log common
</VirtualHost>

NameVirtualHost mail.server.com
<VirtualHost 192.168.1.2:80>
ServerAdmin (E-Mail Removed)
DocumentRoot /www/mail
ServerName mail.server.com
ErrorLog /var/log/apache/mail_error_log
CustomLog /var/log/apache/mail_error_log common
</VirtualHost>


But now mail.server.com displays the page from www.server.com


What am I missing? How can I sucessfully add the mail.server.com
subdomain to resolve to /www/mail?

Thanks in advance, guys!


--
Michael

r-znvy: zvpunry.wryqra jro.qr (chg gur "@" jurer vg svgf...)
ab fcnz cyrnfr


upro
Reply With Quote
  #2  
Old 11-25-2004, 12:14 PM
Davide Bianchi
Guest
 
Posts: n/a
Default Re: apache viurtual hosts

On 2004-11-25, upro <(E-Mail Removed)> wrote:
><VirtualHost 192.168.1.2:80>


If you are using name-based virtualhosts don't use an IP address, use *

> displayed. But www.server.com also pointed to mail.server.com.


If there is only one vhost, that is used to serve all the requests, if
you have multiple vhost, the first one defined (or the one defined with
_default_) is used to serve all the requests for unknown Vhosts.

> NameVirtualHost www.server.com <<< what's this?
> NameVirtualHost mail.server.com <<< what's this?


You need ONE "NameVirtualHost" directives, not more. Than any number
of <VirtualHost> blocks. Again, use * not a hostname or an IP.

NOTE: the example configuration in httpd.conf DOES WORK.

> What am I missing?


The documentation, on httpd.apache.org

Davide

--
"I'm not lean and mean, I'm surly and anorexic".
-- Chris "Saundo" Saunderson on alt.sysadmin.recovery
Reply With Quote
  #3  
Old 11-25-2004, 12:19 PM
upro
Guest
 
Posts: n/a
Default Re: apache viurtual hosts

Davide Bianchi <(E-Mail Removed)> writes:

> On 2004-11-25, upro <(E-Mail Removed)> wrote:
>><VirtualHost 192.168.1.2:80>

>
> If you are using name-based virtualhosts don't use an IP address, use *
>
>> displayed. But www.server.com also pointed to mail.server.com.

>
> If there is only one vhost, that is used to serve all the requests, if
> you have multiple vhost, the first one defined (or the one defined with
> _default_) is used to serve all the requests for unknown Vhosts.
>
>> NameVirtualHost www.server.com <<< what's this?
>> NameVirtualHost mail.server.com <<< what's this?

>
> You need ONE "NameVirtualHost" directives, not more. Than any number
> of <VirtualHost> blocks. Again, use * not a hostname or an IP.
>
> NOTE: the example configuration in httpd.conf DOES WORK.
>
>> What am I missing?

>
> The documentation, on httpd.apache.org
>
> Davide



Thanks, now I got it! I tried lots of hints form the doc, but I
believed the * was to be replaced by my actual IP or server
name. Somehow misleading in the documentation...

Thanks a lot, you relieved me!

--
Michael

r-znvy: zvpunry.wryqra jro.qr (chg gur "@" jurer vg svgf...)
ab fcnz cyrnfr
Reply With Quote
Reply

Tags
apache, hosts, viurtual

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 02:23 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.