You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Mike -- EMAIL IGNORED <m_...@yahoo.com> on 2009/07/22 20:01:33 UTC
[users@httpd] httpd.config "subroutine"
I have several <VirtualHost> and numerous <Directory>
sections that have large sets of identical directives.
If there a way to define a "subroutine" in httpd.config
that can be called in these sections?
Thanks for your help.
Mike.
---------------------------------------------------------------------
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] httpd.config "subroutine"
Posted by Jonas Eckerman <jo...@frukt.org>.
Mike -- EMAIL IGNORED wrote:
> I have several <VirtualHost> and numerous <Directory>
> sections that have large sets of identical directives.
> If there a way to define a "subroutine" in httpd.config
> that can be called in these sections?
If you want to be able pass simple "parameters" to the "subroutine"
sections, check out mod_macro at
<http://cri.ensmp.fr/~coelho/mod_macro/>.
I use it for vhosts the way you describe, and I really like it.
An example:
---8<---
<Macro Reverse %address %admin %server %domain %aliases>
<VirtualHost %address>
ServerAdmin %admin
ServerName www.%domain
ServerAlias %domain %aliases
Include /usr/local/etc/apache22/filter/proxy.conf
ProxyPass / http://%server/ keepalive=on retry=10
ProxyPassReverse / http://%server/
ProxyErrorOverride On
ProxyPreserveHost On
ProxyPassReverseCookieDomain %server www.%domain
CacheEnable disk /
</VirtualHost>
</Macro>
Use Reverse 10.0.7.11:80 admin@fsdb.org 10.0.7.13 edbu.org w3.edbu.org
Use Reverse 10.0.7.11:80 admin@fsdb.org 10.0.7.13 wfdb.org w3.wfdb.org
Use Reverse 10.0.7.202:80 admin@fsdb.org 10.0.6.10 fsdb.se w3.fsdb.se
---8<---
There are 28 more "Use Reverse " lines in the config, with different
addresses and admins, and some with a whole bunch of aliases at the end.
And then there's a bunch of vhosts using other macros as well. This way
made it a lot easier to maintain than using includes.
Another option could be mod_perl, wich, IIRC, allows you to use perl in
the config files.
Regards
/Jonas
--
Jonas Eckerman
Fruktträdet & Förbundet Sveriges Dövblinda
http://www.fsdb.org/
http://www.frukt.org/
http://whatever.frukt.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] httpd.config "subroutine"
Posted by Peter Schober <pe...@univie.ac.at>.
* Mike -- EMAIL IGNORED <m_...@yahoo.com> [2009-07-22 20:02]:
> I have several <VirtualHost> and numerous <Directory>
> sections that have large sets of identical directives.
> If there a way to define a "subroutine" in httpd.config
> that can be called in these sections?
There is http://httpd.apache.org/docs/2.2/en/mod/core.html#include
-peter
---------------------------------------------------------------------
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
[users@httpd] Re: httpd.config "subroutine"
Posted by Dan Poirier <po...@pobox.com>.
You can Include the same file repeatedly:
http://httpd.apache.org/docs/2.2/mod/core.html#include
--
Dan Poirier <po...@pobox.com>
---------------------------------------------------------------------
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