You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jerome Schevingt <li...@nightrain.com> on 2004/01/27 06:40:43 UTC

[users@httpd] Apache Vhost.conf into a mysql table ?

Hi

two question please :

    I am search a solution, on Apache 2.0.XX (a modules ?) for the
vhosts.conf are into a MySQL Table.

I use one of my Apache serveur for RedirectPermanent and RewriteRules,
actually, i use a file ..

Into the table, i want put all information of <VirtualHost xxxxxx> and
dynamiquely load at all request

Do you know a solution ?

bye


Re: [users@httpd] Apache Vhost.conf into a mysql table ?

Posted by Jonas Eckerman <jo...@frukt.org>.
On Wed, 28 Jan 2004 18:30:13 +0100, Jerome Schevingt wrote:

>  but i thinks that if i use mod_perl for create the configuration,
>  it's not loaded dynamiquely no ? The configuration are created
>  when the server start no ?

Yes. If you do it that way. But read on.

mod_perl also give you the ability to write "handlers" that get called in the different phases each request goes through inside Apache. With mod_perl you should be able to write a perl handler that gets the request from Apache, looks up the hostname in MySQL and correctly sets up the local environment for it.

I do not have an example for this, but there's lots of informative but poorly structured docs about how to write mod_perl handlers at perl.apache.org. There's also examples, and it's conceivable that you might find an example that provides hints as to how to handle dynamic virtual hosts with mod_perl. Examples as to how to lookup the info in MySQL is outside the scope for mod_perl docs as well as the Apache list though, but www.cpan.org should have some hints on how to use the perl DBI.

Regards
/Jonas
-- 
Jonas Eckerman, jonas_lists@frukt.org
http://www.fsdb.org/


---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache Vhost.conf into a mysql table ?

Posted by Jerome Schevingt <li...@nightrain.com>.
Thanks for your answer,

but i thinks that if i use mod_perl for create the configuration, it's not
loaded dynamiquely no ?
The configuration are created when the server start no ?

Anyone have a exemple in mod_perl of VirtualHost config stocked in MySQL
Table ?

Bye





----- Original Message ----- 
From: "Jez Hancock" <je...@munk.nu>
To: "Jerome Schevingt" <li...@nightrain.com>
Cc: <us...@httpd.apache.org>
Sent: Tuesday, January 27, 2004 7:57 PM
Subject: Re: [users@httpd] Apache Vhost.conf into a mysql table ?


> On Tue, Jan 27, 2004 at 06:40:43AM +0100, Jerome Schevingt wrote:
> >     I am search a solution, on Apache 2.0.XX (a modules ?) for the
> > vhosts.conf are into a MySQL Table.
> >
> > I use one of my Apache serveur for RedirectPermanent and RewriteRules,
> > actually, i use a file ..
> >
> > Into the table, i want put all information of <VirtualHost xxxxxx> and
> > dynamiquely load at all request
> >
> > Do you know a solution ?
>
> You could look into using mod_perl to generate your httpd.conf
> vhost stubs dynamically.
>
> Essentially you would enable mod_perl in httpd.conf and then use perl
> scripting inside your httpd.conf file to generate the required vhost
> stubs, gathering the vhost data as required from the mysql db.
>
> I've not tried this, but from what little I've read from the mod_perl
> specs you should be able to do this kind of thing.
>
> See here for more info:
>
>
http://perl.apache.org/docs/1.0/guide/config.html#Apache_Configuration_in_Perl
>
> -- 
> Jez Hancock
>  - System Administrator / PHP Developer
>
> http://munk.nu/
> http://jez.hancock-family.com/  - Another FreeBSD Diary
> http://ipfwstats.sf.net/        - ipfw peruser traffic logging
>
> ---------------------------------------------------------------------
> 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
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Apache Vhost.conf into a mysql table ?

Posted by Jez Hancock <je...@munk.nu>.
On Tue, Jan 27, 2004 at 06:40:43AM +0100, Jerome Schevingt wrote:
>     I am search a solution, on Apache 2.0.XX (a modules ?) for the
> vhosts.conf are into a MySQL Table.
> 
> I use one of my Apache serveur for RedirectPermanent and RewriteRules,
> actually, i use a file ..
> 
> Into the table, i want put all information of <VirtualHost xxxxxx> and
> dynamiquely load at all request
> 
> Do you know a solution ?

You could look into using mod_perl to generate your httpd.conf
vhost stubs dynamically.

Essentially you would enable mod_perl in httpd.conf and then use perl 
scripting inside your httpd.conf file to generate the required vhost
stubs, gathering the vhost data as required from the mysql db.

I've not tried this, but from what little I've read from the mod_perl
specs you should be able to do this kind of thing.

See here for more info:

http://perl.apache.org/docs/1.0/guide/config.html#Apache_Configuration_in_Perl

-- 
Jez Hancock
 - System Administrator / PHP Developer

http://munk.nu/
http://jez.hancock-family.com/  - Another FreeBSD Diary
http://ipfwstats.sf.net/        - ipfw peruser traffic logging

---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org