<-
Apache > HTTP Server > Documentation > Version 2.4 > Modules

Apache Module mod_macro 1.2.1

Available Languages:  en 

Description: This module provides usage of macros within apache runtime configuration files
Status: Extension
Module Identifier: macro_module
Source File: mod_macro.c
Homepage: http://people.apache.org/~fabien/mod_macro

Summary

This module is contained in the mod_macro.c file, and is not compiled in by default. It provides for using macros within apache runtime configuration files. These macros can be given arguments. They are expanded when used (arguments are substituted by their values), and the result is processed normally.

This documentation describes version 1.2.1 of mod_macro. For the latest version see: http://people.apache.org/~fabien/mod_macro

Directives

Topics

top

Features

Definition of a macro: Use of a macro: Misc:
top

Error directive

Description: Raise error message
Syntax: Error message
Context: server config, virtual host, directory
Status: Extra
Module: mod_macro
Compatibility: Apache 1.3, 2.0, 2.2 and 2.4

This directive issues an error from the configuration file and stop processing it.

Example:

<IfModule !mod_perl.c>
Error Hey, you forgot to install mod_perl! I need it!
</IfModule>

top

<Macro> directive

Description: Defines a macro which can be used later
Syntax: <Macro name [arg1 .. argN]
Context: server config, virtual host, directory
Status: Extra
Module: mod_macro
Compatibility: Apache 1.3, 2.0, 2.2 and 2.4

This directive controls the definition of a macro within the server runtime configuration files. The first argument is the name of the macro. Others are arguments to the macro. It is good practice to prefix argument names with any of '$%@', and not macro names with such characters.

Note

If you're using mod_macro along with mod_define, do not use the '$' character as a prefix to macro arguments (because this character is reserved for defined variables). Also mod_define variable substitution is performed after macro expansion.

Example:

<Macro LocalAccessPolicy>
order deny,allow
deny from all
allow from 10.2.16.0/24
</Macro>

<Macro RestrictedAccessPolicy $ipnumbers>
order deny,allow
deny from all
allow from $ipnumbers
</Macro>

top

Use directive

Description: Use a macro
Syntax: Use name [value1 .. valueN]
Context: server config, virtual host, directory
Status: Extra
Module: mod_macro
Compatibility: Apache 1.3, 2.0, 2.2 and 2.4

This 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 associated to their corresponding initial argument and are substituted before processing.

Use LocalAccessPolicy

...

Use RestrictedAccessPolicy "192.54.172.0/24 192.54.148.0/24"

is equivalent, with the macros defined above, to:

order deny,allow
deny from all
allow from 10.2.16.0/24

...

order deny,allow
deny from all
allow from 192.54.172.0/24 192.54.148.0/24

top

Warning directive

Description: Raise a warning on processing configuration file
Syntax: Warning message
Context: server config, virtual host, directory
Status: Extra
Module: mod_macro
Compatibility: Apache 1.3, 2.0, 2.2 and 2.4

This directive issues a warning from the configuration file. Processing goes on.

Example

<IfDefine !RunProxy>
Warning The PROXY will not run!
</IfDefine>

<IfDefine RunProxy>
# proxy configuration
...
</IfDefine>

Available Languages:  en