|
Home > Archive > Apache Server configuration support > November 2006 > resin can do regex based hosts, (why|how) can('t) apache?
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 |
resin can do regex based hosts, (why|how) can('t) apache?
|
|
| George Cooke 2006-11-28, 1:39 am |
| I want to define a VirtualHost based on a regular expression match, like
this (pseudo directives):
<VirtualHost .*mysite\d*\.com>
DocumentRoot /blah/mysite.com
other virtual host specific apache directives here...
</VirtualHost>
<VirtualHost .*myothersite\d*\.com>
DocumentRoot /blah/myothersite.com
other virtual host specific apache directives here...
</VirtualHost>
I would like to have the configs separate so that if one is not enabled
(a2dissite) then the default site will be used (how it should be).
The sites rely on the host header for content.
The obvious first choice is mass dynamic virtual hosts, but I can only
find the option of interpolating various request variables into the
virtualdocumentroot, which will not work (unless I create lots of
symlinks for each different host, dont want to do that) plus then all
the configs are placed together in one spot, i prefer separate as stated
above.
mod_rewrite is good, i use it for other stuff, but I cannot configure a
vhost depending on a rewriteCond... I could rewrite to directories based
on rewritecond host and separate the logs with logformat, but again, the
conf would all run from the default site, which is pants.
mod_setenvif provides me to match a host and set a var, but once again I
cannot really utilise this env= to conditionally configure a
virtualhost, only customlog and lots of cgi stuff i dont need.
What I really need, is a way to conditionally set a documentroot (and
other apache virtualhost context directives) based on a regular
expression against the host header, is there any way you can think of
that would enable me to do this??
http://www.caucho.com/resin-3.0/config/resin.xtp#host - look at regexp
host, this is what i want to be able to do, there is a module for
apache but i think you need the resinconf server or whatever running
which is a bit beyond the point really.
I would love to make a module to do this, any direction would be helpful.
| |
| Davide Bianchi 2006-11-28, 7:34 am |
| On 2006-11-28, George Cooke <geocoo@gmail.com> wrote:
> I would love to make a module to do this, any direction would be helpful.
I'd start by reading the 'developer' documentation and getting in touch
with the Apache group, this has nothing to do with the configuration of
Apache, maybe you can get some more info by subscribing to the
developers mailing list.
Davide
--
Choose two:
(A) Fast (B) Efficient (C) Stable (D) Windows 95 (counts as two)
| |
|
|
"George Cooke" <geocoo@gmail.com> schreef in bericht
news:C_6dnUs-5ZK3APbYnZ2dnUVZ8q6dnZ2d@eclipse.net.uk...
>I want to define a VirtualHost based on a regular expression match, like
> I would like to have the configs separate so that if one is not enabled
> (a2dissite) then the default site will be used (how it should be).
Use
Include /usr/local/apache2/conf/vhosts/*.conf
and have one vhost per file outside the main server config
http://httpd.apache.org/docs/2.0/mod/core.html#include
Some distributions use
Include /usr/local/apache2/conf/vhosts/enabled/*.conf
and have one symlink per vhost to a file in
/usr/local/apache2/conf/vhosts/available/*.conf
per file outside the main server config
> The sites rely on the host header for content.
Right, as per HTTP/1.1
> The obvious first choice is mass dynamic virtual hosts, but I can only
> find the option of interpolating various request variables into the
> virtualdocumentroot,
VirtualDocumentRoot and VirrtualScriptAlias is a bommer anyway, there is
a history of not pars the dynamic document_root [correctly] to scripts
http://httpd.apache.org/docs/2.0/mo...host_alias.html
> which will not work (unless I create lots of symlinks for each different
> host, dont want to do that) plus then all the configs are placed together
> in one spot, i prefer separate as stated above.
Consider alias-ses ...
> mod_rewrite is good, i use it for other stuff, but I cannot configure a
> vhost depending on a rewriteCond... I could rewrite to directories based
> on rewritecond host and separate the logs with logformat, but again, the
> conf would all run from the default site, which is pants.
>
> mod_setenvif provides me to match a host and set a var, but once again I
> cannot really utilise this env= to conditionally configure a virtualhost,
> only customlog and lots of cgi stuff i dont need.
>
> What I really need, is a way to conditionally set a documentroot (and
> other apache virtualhost context directives) based on a regular expression
> against the host header, is there any way you can think of that would
> enable me to do this??
The untested lines below
Servername www.domain0.com
ServerAlias domain0.com
ServerAlias www.domain1.com
ServerAlias domain1.com
ServerAlias www.domain2.com
ServerAlias domain2.com
DocumentRoot /www/html/
RewriteEngine on
RewriteCond %{HTTP_HOST} ^!(www\.)domain0\.com$
RewriteCond %{HTTP_HOST} ^(www\.)[^.]+\.com$
RewriteRule ^(.+) %1$1 [QSA]
will virtuallize multiple domains into a single host
> http://www.caucho.com/resin-3.0/config/resin.xtp#host - look at regexp
> host, this is what i want to be able to do, there is a module for apache
> but i think you need the resinconf server or whatever running which is a
> bit beyond the point really.
That module just making [a vhost in] apache a [partial] proxy to resin.
> I would love to make a module to do this, any direction would be helpful.
That's far beyond my scope ...
HansH
| |
| shimmyshack 2006-11-28, 7:34 am |
| I too find the limitations of DCMVH frustrating. If you get interested
in the A2API and write this module I will test it for you. ;)
|
|
|
|
|