From 2a463b3cd73c32ee9dcd508248d0194923f435f4 Mon Sep 17 00:00:00 2001
From: Stefan Fritsch
For example, you might use a macro to define a <VirtualHost>
block, in order to define
multiple similar virtual hosts:
-<Macro VHost $name $domain> +<Macro VHost $name $domain> <VirtualHost *:80> ServerName $domain ServerAlias www.$domain @@ -74,8 +73,7 @@ multiple similar virtual hosts: ErrorLog /var/log/httpd/$name.error_log CustomLog /var/log/httpd/$name.access_log combined </VirtualHost> -</Macro> -+</Macro>
Macro names are case-insensitive, like httpd configuration @@ -84,13 +82,11 @@ directives. However, variable names are case sensitive.
You would then invoke this macro several times to create virtual hosts:
--Use VHost example example.com +Use VHost example example.com Use VHost myhost hostname.org Use VHost apache apache.org -UndefMacro VHost -+UndefMacro VHost
At server startup time, each of these Use
@@ -110,7 +106,7 @@ Examples section.
Parameter names should begin with a sigil such as $
,
%
, or @
, so that they are clearly
-identifiable, and also in order to help deail with interactions with
+identifiable, and also in order to help deal with interactions with
other directives, such as the core Define
directive. Failure to do so will
result in a warning. Nevertheless, you are encouraged to have a good
knowledge of your entire server configuration in order to avoid reusing
@@ -128,11 +124,9 @@ confusion, the longest possible parameter name is used.
If you want to use a value within another string, it is useful to surround the parameter in braces, to avoid confusion:
--<Macro DocRoot ${docroot}> +@@ -146,8 +140,7 @@ surround the parameter in braces, to avoid confusion:<Macro DocRoot ${docroot}> DocumentRoot /var/www/${docroot}/htdocs -</Macro> -+</Macro>
A common usage of mod_macro
is for the creation of
dynamically-generated virtual hosts.
-## Define a VHost Macro for repetitive configurations +@@ -184,8 +176,7 @@ Use VHost www.example.fr 1234 /vhosts/example.fr/htdocs avoids confusion in a complex configuration file where there may be conflicts in variable names. -## Define a VHost Macro for repetitive configurations <Macro VHost $host $port $dir> Listen $port @@ -172,8 +165,7 @@ dynamically-generated virtual hosts. Use VHost www.apache.org 80 /vhosts/apache/htdocs Use VHost example.org 8080 /vhosts/example/htdocs -Use VHost www.example.fr 1234 /vhosts/example.fr/htdocs -+Use VHost www.example.fr 1234 /vhosts/example.fr/htdocs
-<Macro DirGroup $dir $group> +@@ -220,15 +210,13 @@ UndefMacro DirGroup with such characters. -<Macro DirGroup $dir $group> <Directory $dir> Require group $group </Directory> @@ -194,8 +185,7 @@ conflicts in variable names. Use DirGroup /www/apache/private private Use DirGroup /www/apache/server admin -UndefMacro DirGroup -+UndefMacro DirGroup
-<Macro LocalAccessPolicy> +@@ -244,10 +232,8 @@ UndefMacro DirGroup<Macro LocalAccessPolicy> Require ip 10.2.16.0/24 </Macro> <Macro RestrictedAccessPolicy $ipnumbers> Require ip $ipnumbers -</Macro> -+</Macro>
The UndefMacro
directive undefines a macro
which has been defined before hand.
-UndefMacro LocalAccessPolicy -UndefMacro RestrictedAccessPolicy -+
UndefMacro LocalAccessPolicy +UndefMacro RestrictedAccessPolicy@@ -263,24 +249,20 @@ UndefMacro RestrictedAccessPolicy
The Use
directive controls the use of a macro.
The specified macro is expanded. It must be given the same number of
- arguments than in the macro definition. The provided values are
+ arguments as in the macro definition. The provided values are
associated to their corresponding initial parameters and are substituted
before processing.
-Use LocalAccessPolicy +Use LocalAccessPolicy ... -Use RestrictedAccessPolicy "192.54.172.0/24 192.54.148.0/24" -+Use RestrictedAccessPolicy "192.54.172.0/24 192.54.148.0/24"
is equivalent, with the macros defined above, to:
--Require ip 10.2.16.0/24 +@@ -306,7 +288,7 @@ var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_macro.html'; } })(window, document); //-->Require ip 10.2.16.0/24 ... -Require ip 192.54.172.0/24 192.54.148.0/24 -+Require ip 192.54.172.0/24 192.54.148.0/24