You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Marten Lehmann <le...@variomedia.de> on 2002/04/29 18:17:40 UTC

mass-hosting and DOCUMENT_ROOT

Hello,

as far as I know there are 3 ways to realize mass-hosting with apache 
(host to path translation):

1. mod_rewrite
2. virtualdocumentroot (mod_vhost_alias)
3. using a mod_perl-handler for URI-translation

At this time I'm using the third way for my webhosting-system. But all 
ways have one problem: They can't set DOCUMENT_ROOT for each host, as it 
would have been set when the host would appear in httpd.conf as 
virtualhost with documentroot-directive.
My idea is to write my own apache-module, that does the host to path 
translation and additionally set the DOCUMENT_ROOT variable. But before 
I start, I would like to know, if it is possible to set this 
environment-variable in this phase so it takes effect in the later 
content-processing. I tried to set the variable inside my 
mod_perl-handler, but when the script I called through http was 
executed, the standard-document-root appeared again.

Regards
Marten Lehmann


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: mass-hosting and DOCUMENT_ROOT

Posted by Artiom Morozov <ar...@phreaker.net>.
once you know document root in your module, add it to request url and 
give some unique separator, say, //. adjust modules execution so that 
mod_rewrite works after you. Then just do

RewriteRule (.+)//(.+)	$2 [E=DOCUMENT_ROOT:$1]

It's only a generic idea and may need to be polished. Btw, i think 
PerlPassEnv should work for you, again, just play with modules 
execution order, you should reset doc root only after mapping to fs is 
done.

îÁ 2002.04.29 20:07 Marten Lehmann ÎÁÐÉÓÁÌ:
> Hello,
> 
>> Sorry, i can't check right now what i'm stating, but you can prepent 
>> this path to url and move it to DOC_ROOT with rewriterule.
> 
> I want to set DOCUMENT_ROOT dynamically, depending on which host is 
> called the document path changes. Additionally, for cgi-scripts the 
> environment-variable DOCUMENT_ROOT shall be set to this directory. 
> How can I do this?
> 
> Regards
> Marten Lehmann
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: mass-hosting and DOCUMENT_ROOT

Posted by Marten Lehmann <le...@variomedia.de>.
Hello,

> Sorry, i can't check right now what i'm stating, but you can prepent 
> this path to url and move it to DOC_ROOT with rewriterule.

I want to set DOCUMENT_ROOT dynamically, depending on which host is 
called the document path changes. Additionally, for cgi-scripts the 
environment-variable DOCUMENT_ROOT shall be set to this directory. How 
can I do this?

Regards
Marten Lehmann


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: mass-hosting and DOCUMENT_ROOT

Posted by Artiom Morozov <ar...@phreaker.net>.
Sorry, i can't check right now what i'm stating, but you can prepent 
this path to url and move it to DOC_ROOT with rewriterule.

îÁ 2002.04.29 19:17 Marten Lehmann ÎÁÐÉÓÁÌ:
> Hello,
> 
> as far as I know there are 3 ways to realize mass-hosting with apache 
> (host to path translation):
> 
> 1. mod_rewrite
> 2. virtualdocumentroot (mod_vhost_alias)
> 3. using a mod_perl-handler for URI-translation
> 
> At this time I'm using the third way for my webhosting-system. But 
> all ways have one problem: They can't set DOCUMENT_ROOT for each 
> host, as it would have been set when the host would appear in 
> httpd.conf as virtualhost with documentroot-directive.
> My idea is to write my own apache-module, that does the host to path 
> translation and additionally set the DOCUMENT_ROOT variable. But 
> before I start, I would like to know, if it is possible to set this 
> environment-variable in this phase so it takes effect in the later 
> content-processing. I tried to set the variable inside my 
> mod_perl-handler, but when the script I called through http was 
> executed, the standard-document-root appeared again.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org