Apache Server configuration support - Virtual domain stoopid kweschun

This is Interesting: Free IT Magazines  
Home > Archive > Apache Server configuration support > April 2007 > Virtual domain stoopid kweschun





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Virtual domain stoopid kweschun
Nooze Goy

2007-04-30, 1:23 pm

I'm learning... but I haven't found this so far. Probably it's right
before my very eyes and I just keep missing it, or maybe I'm just
looking in the wrong place... anyway:

I've (finally) got four or five domains serving web site data, but there
is a problem with the "www dot" versus plain old name.

That is, I have mydomain.com working just fine, but if you try to go to
www.mydomain.com, although DNS finds the same IP address, when the
message gets to my server, it wants to serve the index.html from
/home/virtwww/www.mydomain.com and not /home/virtwww/mydomain.com - so
how do I tell httpd to strip the "www." off of it and use the same
directory for both?

Here's what I've got right now - it looked from the doc that this oughta
do it, but it still wants two different directoris for mydomain.com and
www.mydomain.com

<VirtualHost mydomain.com:80>
ServerName mydomain.com
ServerAlias mydomain.com *.mydomain.com
DocumentRoot /home/virtwww/mydomain.com
<Directory "/home/virtwww/mydomain.com">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

Is this just the wrong order, or what?
Nooze Goy

2007-04-30, 1:23 pm

Nooze Goy wrote:
> I'm learning... but I haven't found this so far. Probably it's right
> before my very eyes and I just keep missing it, or maybe I'm just
> looking in the wrong place... anyway:
>
> I've (finally) got four or five domains serving web site data, but there
> is a problem with the "www dot" versus plain old name.
>
> That is, I have mydomain.com working just fine, but if you try to go to
> www.mydomain.com, although DNS finds the same IP address, when the
> message gets to my server, it wants to serve the index.html from
> /home/virtwww/www.mydomain.com and not /home/virtwww/mydomain.com - so
> how do I tell httpd to strip the "www." off of it and use the same
> directory for both?
>
> Here's what I've got right now - it looked from the doc that this oughta
> do it, but it still wants two different directoris for mydomain.com and
> www.mydomain.com
>
> <VirtualHost mydomain.com:80>
> ServerName mydomain.com
> ServerAlias mydomain.com *.mydomain.com
> DocumentRoot /home/virtwww/mydomain.com
> <Directory "/home/virtwww/mydomain.com">
> allow from all
> Options +Indexes
> </Directory>
> </VirtualHost>
>
> Is this just the wrong order, or what?



I found part of the answer. In virtual.conf, there was
VirtualDocumentRoot /home/virtwww/$0
and when I commented it out, (AND changed the VirtualHost to
www.mydomain.com) it started working...

However, now ALL domains wind up at /home/virtwww/mydomain.com instead
of at their desired /home/virtwww/another.com at cetera.

I noticed the httpd startup now complains about overlapping VirtualHost,
so there's more cleanup in store...
Mark Taylor

2007-04-30, 1:23 pm

Nooze Goy <noozegoy@pookmail.com> wrote in
news:f157ne02v5h@news3.newsguy.com:

> Nooze Goy wrote:
>
>
> I found part of the answer. In virtual.conf, there was
> VirtualDocumentRoot /home/virtwww/$0
> and when I commented it out, (AND changed the VirtualHost to
> www.mydomain.com) it started working...
>
> However, now ALL domains wind up at /home/virtwww/mydomain.com instead
> of at their desired /home/virtwww/another.com at cetera.
>
> I noticed the httpd startup now complains about overlapping
> VirtualHost, so there's more cleanup in store...
>


I think you should eliminate some of this...

ServerName mydomain.com
ServerAlias mydomain.com *.mydomain.com


Change it to this:

ServerName mydomain.com
ServerAlias www.mydomain.com


And, both mydomain.com and www.mydomain.com must be in your DNS records
properly.


Maybe it will fix your problem and maybe it won't. worth a try.



----== Posted via webservertalk.com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.webservertalk.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nooze Goy

2007-04-30, 1:23 pm

Nooze Goy wrote:
> Nooze Goy wrote:
>
>
> I found part of the answer. In virtual.conf, there was
> VirtualDocumentRoot /home/virtwww/$0
> and when I commented it out, (AND changed the VirtualHost to
> www.mydomain.com) it started working...
>
> However, now ALL domains wind up at /home/virtwww/mydomain.com instead
> of at their desired /home/virtwww/another.com at cetera.
>
> I noticed the httpd startup now complains about overlapping VirtualHost,
> so there's more cleanup in store...


Seems to be working, like this:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.mydomain.com
ServerAlias mydomain.com *.mydomain.com
DocumentRoot /home/virtwww/mydomain.com
<Directory "/home/virtwww/mydomain.com">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName www.anotherdomain.com
ServerAlias anotherdomain.com *.anotherdomain.com
DocumentRoot /home/virtwww/anotherdomain.com
<Directory "/home/virtwww/anotherdomain.com">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
Nooze Goy

2007-04-30, 7:22 pm

Mark Taylor wrote:
> I think you should eliminate some of this...
>
> ServerName mydomain.com
> ServerAlias mydomain.com *.mydomain.com
>
>
> Change it to this:
>
> ServerName mydomain.com
> ServerAlias www.mydomain.com
>
>
> And, both mydomain.com and www.mydomain.com must be in your DNS records
> properly.
>
>
> Maybe it will fix your problem and maybe it won't. worth a try.
>



Hey, thanks for the response. As noted in my reply to me, it's fixed -
at least so far as http is concerned... Now, to get mail working, which
may be a lot bigger PITA than this has been!

Thanks again.
shimmyshack

2007-04-30, 7:22 pm

On Apr 30, 8:26 pm, Nooze Goy <nooze...@pookmail.com> wrote:
> Mark Taylor wrote:
>
>
>
>
>
>
> Hey, thanks for the response. As noted in my reply to me, it's fixed -
> at least so far as http is concerned... Now, to get mail working, which
> may be a lot bigger PITA than this has been!
>
> Thanks again.


by removing virtualdocumentroot, you have effectively disabled
dynamically configured mass virtual hosting, which is very useful.
You can still have that AND your setup working, by having a redirect
in the folders associated with unneeded subdomains, so in the
mydomainname.com you have a simple script as index.php
<?php
$servername = 'mydomainname.com';
header( 'Location: http://www.' . $servername . '/' .
$_SERVER["REQUEST_URI"] );
?>

I know its no fun, but it does mean you can keep DCMVH and yet alias
www.mydomainname.com with mydomainname.com leaving the other sub
domains unaffected. You then do not need the ServerAlias www.mydomainname.com
directive in the vhost section or indeed any vhost section at all if
you dont need to alter the defaults.

One point though I notice you use *.mydomainname.com
I thought this was not possible. (Of course it wouldnt make sense with
DCMVH) but I didnt think apache honoured this, if anyone has a pointer
to some docs please could you post it here.

HansH

2007-04-30, 7:22 pm

"Nooze Goy" <noozegoy@pookmail.com> schreef in bericht
news:f157ne02v5h@news3.newsguy.com...
> I found part of the answer. In virtual.conf, there was
> VirtualDocumentRoot /home/virtwww/$0

That syntax is typical for
http://httpd.apache.org/docs/2.2/mo...host_alias.html

UseCanonicalName Off
VirtualDocumentRoot /usr/local/apache/vhosts/%0
A request for http://www.example.com/directory/file.html
will be satisfied by the file
/usr/local/apache/vhosts/www.example.com/directory/file.html.


HansH


Nooze Goy

2007-04-30, 7:22 pm

shimmyshack wrote:

> One point though I notice you use *.mydomainname.com
> I thought this was not possible. (Of course it wouldnt make sense with
> DCMVH) but I didnt think apache honoured this, if anyone has a pointer
> to some docs please could you post it here.


In fact, I got this (*.mydomain.com) from the apach site its own self...
http://httpd.apache.org/docs/1.3/vhosts/name-based.html

It seems to work, and it's plenty fast, even on the thousand-year-old
smallRAM croaker I'm using here...

Now, if I can just get the *&#$& Postfix to start seeing incoming mail,
I'll be glad I told the web-hosting service to stick it...



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2009 webservertalk.com