You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Florian Lindner <ma...@xgm.de> on 2006/12/13 19:03:34 UTC

[users@httpd] Templated config for vhost

Hello,
is is possible to define a template for a vhost config entry and use this 
template in other entries. 
For example I have the template:

<Template>
        ServerName $SERVER_NAME
        ServerAlias *.$SERVER_NAME $MORE_ALIASES
        DocumentRoot /home/$DIR/http/pub
        CustomLog /home/$DIR/http/log/access.log combined
        ErrorLog /home/$DIR/http/log/error.log
        php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f 
webmaster@$SERVER_NAME"
        php_admin_value open_basedir "/home/$DIR/http"
</Template>

now a config use this template

<VirtualHost *>
        $SERVER_NAME xgm.de
        $DIR xgmde
        $MORE_ALIASES someotherdomain.tld
</VirtualHost>

Can I do something like this?

Thanks,

Florian

---------------------------------------------------------------------
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] Templated config for vhost

Posted by Florian Lindner <ma...@xgm.de>.
Am Donnerstag, 14. Dezember 2006 19:22 schrieb Joshua Slive:
> On 12/13/06, Florian Lindner <ma...@xgm.de> wrote:
> > Hello,
> > is is possible to define a template for a vhost config entry and use this
> > template in other entries.
> > For example I have the template:
> >
> > <Template>
> >         ServerName $SERVER_NAME
> >         ServerAlias *.$SERVER_NAME $MORE_ALIASES
> >         DocumentRoot /home/$DIR/http/pub
> >         CustomLog /home/$DIR/http/log/access.log combined
> >         ErrorLog /home/$DIR/http/log/error.log
> >         php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f
> > webmaster@$SERVER_NAME"
> >         php_admin_value open_basedir "/home/$DIR/http"
> > </Template>
> >
> > now a config use this template
> >
> > <VirtualHost *>
> >         $SERVER_NAME xgm.de
> >         $DIR xgmde
> >         $MORE_ALIASES someotherdomain.tld
> > </VirtualHost>
> >
> > Can I do something like this?
>
> Yes, there are various modules available from
> http://modules.apache.org/ that allow you to do stuff like this.  But
> I'd recommend simply pre-processing your config file with
> m4/perl/python/whatever.

Hello,
thanks for the reply! Can you name some of these preprocessors?

Thanks,

Florian

---------------------------------------------------------------------
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] Templated config for vhost

Posted by Krist van Besien <kr...@gmail.com>.
On 12/14/06, Joshua Slive <jo...@slive.ca> wrote:
> On 12/13/06, Florian Lindner <ma...@xgm.de> wrote:
> > Hello,
> > is is possible to define a template for a vhost config entry and use this
> > template in other entries.
> > For example I have the template:
> >
> > <Template>
> >         ServerName $SERVER_NAME
> >         ServerAlias *.$SERVER_NAME $MORE_ALIASES
> >         DocumentRoot /home/$DIR/http/pub
> >         CustomLog /home/$DIR/http/log/access.log combined
> >         ErrorLog /home/$DIR/http/log/error.log
> >         php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f
> > webmaster@$SERVER_NAME"
> >         php_admin_value open_basedir "/home/$DIR/http"
> > </Template>
> >
> > now a config use this template
> >
> > <VirtualHost *>
> >         $SERVER_NAME xgm.de
> >         $DIR xgmde
> >         $MORE_ALIASES someotherdomain.tld
> > </VirtualHost>
> >
> > Can I do something like this?
>
> Yes, there are various modules available from
> http://modules.apache.org/ that allow you to do stuff like this.  But
> I'd recommend simply pre-processing your config file with
> m4/perl/python/whatever.

I had a similar problem, but solved it using mod_perl. Most of my
config is now written in perl...

Krist


-- 
krist.vanbesien@gmail.com
Bremgarten b. Bern, Switzerland
--
"...what you don't realize is that in the future Google WILL reach
sentience, will [have had] invent[ed] a time machine, and will [have
had] travel[ed] back in time to prevent Bill Gates... only to become
Bill Gates by accident because of a search engine optimization
miscalculation." (Comment on the Dilbert Blog)

---------------------------------------------------------------------
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] Templated config for vhost

Posted by Joshua Slive <jo...@slive.ca>.
On 12/13/06, Florian Lindner <ma...@xgm.de> wrote:
> Hello,
> is is possible to define a template for a vhost config entry and use this
> template in other entries.
> For example I have the template:
>
> <Template>
>         ServerName $SERVER_NAME
>         ServerAlias *.$SERVER_NAME $MORE_ALIASES
>         DocumentRoot /home/$DIR/http/pub
>         CustomLog /home/$DIR/http/log/access.log combined
>         ErrorLog /home/$DIR/http/log/error.log
>         php_admin_value sendmail_path "/usr/sbin/sendmail -t -i -f
> webmaster@$SERVER_NAME"
>         php_admin_value open_basedir "/home/$DIR/http"
> </Template>
>
> now a config use this template
>
> <VirtualHost *>
>         $SERVER_NAME xgm.de
>         $DIR xgmde
>         $MORE_ALIASES someotherdomain.tld
> </VirtualHost>
>
> Can I do something like this?

Yes, there are various modules available from
http://modules.apache.org/ that allow you to do stuff like this.  But
I'd recommend simply pre-processing your config file with
m4/perl/python/whatever.

Joshua.

---------------------------------------------------------------------
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