Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 77457 invoked from network); 16 Mar 2007 09:56:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Mar 2007 09:56:53 -0000 Received: (qmail 67260 invoked by uid 500); 16 Mar 2007 09:56:50 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 67239 invoked by uid 500); 16 Mar 2007 09:56:50 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 67225 invoked by uid 99); 16 Mar 2007 09:56:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2007 02:56:50 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of matt.farey@gmail.com designates 66.249.92.171 as permitted sender) Received: from [66.249.92.171] (HELO ug-out-1314.google.com) (66.249.92.171) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2007 02:56:38 -0700 Received: by ug-out-1314.google.com with SMTP id 75so634840ugb for ; Fri, 16 Mar 2007 02:56:16 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; b=ULY9W5EzNO2g3AS/YjolF84cDQhdu3xFEtyazAwf0gpHwJ0E2THbiCN5k24nQ7BPl98eyU+7/w/9EB63ldRYN5V2lHR/8vsrV9+LM2cLkDGYXiu2/87hY8gPagm3fP8LKNgQ1chVSDqvlN254lezSIxkI1Xs/kesWs/jrAaUv4w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; b=NHyEgdwLezE8ZjvjMc9K8oWDgZyttcLaZufxKXOz+5dPh2gTR9ivSXavi4KDtzTnhUiEQRylWe5MNRT4Dm9RTGBFvaIC/TpeGOT3h9KSuez5dhdPL5Wre2zWsBYcBo4WsHS8LV3qKV460kBYOHjJeLAAdv1jDl3u20hIwOcHdz4= Received: by 10.66.239.18 with SMTP id m18mr4279372ugh.1174038976246; Fri, 16 Mar 2007 02:56:16 -0700 (PDT) Received: from ?192.168.0.5? ( [82.69.105.150]) by mx.google.com with ESMTP id m4sm2414590ugc.2007.03.16.02.56.15; Fri, 16 Mar 2007 02:56:15 -0700 (PDT) Message-ID: <45FA69BD.1090602@gmail.com> Date: Fri, 16 Mar 2007 09:56:13 +0000 From: matt farey User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: users@httpd.apache.org References: In-Reply-To: X-Enigmail-Version: 0.94.2.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [users@httpd] Handling VirtualDocumentRoot inside VirtualHosts Alberto Gim�nez wrote: > (First of all, sorry for my english, its not my native language so you > can read some basic/strange language constructions here :) > > Hi, I'm facing a problem with my Apache (1.3.33) setup, I expose the > scenario: > > One single machine is serving several domains (about 300 or so). One > of them has thousands of visits a day (95% of daily load) and the > other domains have very low traffic. > > I use awstats to parse the access_log file and get visit stats on a > daily basis, but it's growing up a lot. I parse the logfile with > awstats_updateall, and what it does is just parse the same log again > and again for each domain (remember, about 300) > > So, I have an access_log with 95% of hits for only one domain, and the > other 300 domains are parsing the same big BIG file to just get 10 > hits or so. It is very inefficient, isn't it? > > The current setup is with a VirtualDocumentRoot directive on server > environment, so all domains are treated the same way. And I'd like to > distinguish the main domain from the oters so parsing speeds up and > gets more effective: > > Hits to main domain go to one access_log file > Hits to any other domain go to *one* single access_log file, so calls > to awstats are against this only logfile. This way I get smaller file > (and quicker to parse) for the 300 domains. > > I got a working setup but I doutbt if it works because I configured it > properly, or is kind of "collateral" effect of apache conffile-parsing > (This is a local network machine, i didn't test it in production > environment :): > > NameVirtualHost 192.168.0.150 > UseCanonicalName Off > LogLevel debug > > > > VirtualDocumentRoot /var/www/sites/%-2.1/%-2.2/%-2.3/%-2.0.%-1/ > DirectoryIndex index.php index.html > CustomLog /var/log/apache/webs_access_log vspecial > > > > > ServerName www.portal.com > ServerAlias portal.com > DocumentRoot /var/www/portal/ > CustomLog /var/log/apache/access_log vspecial > DirectoryIndex index.html index.cgi index.pl index.php > > > I deduced that, as I use the ServerName directive, it just matches the > second VirtualHost if the request is *only* to that name, and uses the > first one in all other cases. Is that correct? Is that setup OK, or is > it working accidentally?? It is correct, I useDCMVH too, just like you I have 1 main with thousands and a hundred smaller ones, I do exactly what you do to separate them - two access log files, except that I also have two error logs as well. > > I tried several combinations: > If I switch Vhosts definition order, it doesn't work. I dont understand why, if the host matches it should use whatever virtualhost has that servername, whatever the order > If I use in the first entry, it works also > for all domains (why? because it is the first one and therefore the > default?). anything which doesnt match a hostname will use the first defined virtualhost, I do not have VirtualDocumentRoot /var/www/sites/%-2.1/%-2.2/%-2.3/%-2.0.%-1/ DirectoryIndex index.php index.html CustomLog /var/log/apache/webs_access_log vspecial I only have VirtualDocumentRoot /var/www/sites/%-2.1/%-2.2/%-2.3/%-2.0.%-1/ DirectoryIndex index.php index.html CustomLog /var/log/apache/webs_access_log vspecial at the end after all my virtualhost definitions > > Could someone please throw some light? I've been searching for mass > virtual hosting with separate logs (not for ALL, but the setup I > exposed here) but didn't find nothing interesting, and I found Apache > documentation a little poor on that topic. Does anyone have a pointer > on how does apache treat internally all the vhosts thing? you are doing fine, this is how it works, and you can define every other thing there as well, you can have custom rewrites, bandwidth rules, but the trick is, every time you want a particular servername to be configured different you have to supply a virtualhost definition to go with the new rules. matt > > Thanks in advance! > --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See 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