Networking Forums

Networking Forums > Computer Networking > Linux Networking > apache viurtual hosts

Reply
Thread Tools Display Modes

apache viurtual hosts

 
 
upro
Guest
Posts: n/a

 
      11-25-2004, 11:09 AM
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
 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      11-25-2004, 11:14 AM
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
 
upro
Guest
Posts: n/a

 
      11-25-2004, 11:19 AM
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

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache virtual hosts not resolving correctly Ninjak on FW Linux Networking 5 01-12-2007 12:56 PM
LAN with no hosts :( will 18 Linux Networking 12 10-18-2006 11:39 PM
hosts.deny and hosts.allow problem dan Linux Networking 3 06-15-2005 07:26 PM
/etc/hosts used only sometimes graeme.pietersz@gmail.com Linux Networking 2 03-09-2005 06:28 AM
Apache Virtual Hosts Rich Grise Linux Networking 6 12-25-2004 10:45 PM



1 2 3 4 5 6 7 8 9 10 11