Current Path : /usr/local/share/doc/apache/mod/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //usr/local/share/doc/apache/mod/mod_define.html |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--%hypertext --> <!-- mod_define.html --> <!-- Documentation for the mod_define Apache module --> <HTML> <HEAD> <TITLE>Apache module mod_define</TITLE> </HEAD> <!-- Background white, links blue (unvisited), navy (visited), red (active) --> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#000080" ALINK="#FF0000" > <BLOCKQUOTE><!-- page indentation --> <!--#include virtual="header.html" --> <BR> <H1 ALIGN="CENTER">Module mod_define</H1> <H2 ALIGN="CENTER">Variable Definition For Arbitrary Directives</H2> This module is contained in the <CODE>mod_define.c</CODE> file. It provides the definition variables for arbitrary directives, i.e. variables which can be expanded on any(!) directive line. It needs Extended API (EAPI). It is not compiled into the server by default. To use <CODE>mod_define</CODE> you have to enable the following line in the server build <CODE>Configuration</CODE> file: <P> <PRE> AddModule modules/extra/mod_define.o </PRE> <P> <HR NOSHADE SIZE=1> <H3><A NAME="Define">Define</A></H3> <A HREF="directive-dict.html#Syntax" REL="Help" ><STRONG>Syntax:</STRONG></A> <CODE>Define</CODE> <EM>variable</EM> <EM>value</EM><BR> <A HREF="directive-dict.html#Default" REL="Help" ><STRONG>Default:</STRONG></A> <EM>none</EM><BR> <A HREF="directive-dict.html#Context" REL="Help" ><STRONG>Context:</STRONG></A> server config, virtual host, directory, .htaccess<BR> <A HREF="directive-dict.html#Override" REL="Help" ><STRONG>Override:</STRONG></A> none<BR> <A HREF="directive-dict.html#Status" REL="Help" ><STRONG>Status:</STRONG></A> Extension<BR> <A HREF="directive-dict.html#Module" REL="Help" ><STRONG>Module:</STRONG></A> mod_define.c<BR> <A HREF="directive-dict.html#Compatibility" REL="Help" ><STRONG>Compatibility:</STRONG></A> Apache+EAPI<BR> <P> The <CODE>Define</CODE> directive defines a variable which later can be expanded with the unsafe but short construct ``<CODE>$</CODE><EM>variable</EM>'' or the safe but longer construct ``<CODE>${</CODE><EM>variable</EM><CODE>}</CODE>'' on any configuration line. Do not intermix this with the third-party module <CODE>mod_macro</CODE>. The <CODE>mod_define</CODE> module doesn't provide a general macro mechanism, although one can consider variable substitutions as a special form of macros. Because the value of to which ``<CODE>$</CODE><EM>variable</EM>'' expands has to fit into one line. When you need macros which can span more lines, you've to use <CODE>mod_macro</CODE>. OTOH <CODE>mod_macro</CODE> cannot be used to expand a variable/macro on an arbitrary directive line. So, the typical use case of <CODE>mod_define</CODE> is to make strings <EM>variable</EM> (and this way easily changeable at one location) and not to <EM>bundle</EM> things together (as it's the typical use case for macros). <P> The syntax of the expansion construct ( ``<CODE>${</CODE><EM>variable</EM><CODE>}</CODE>'') follows the Perl and Shell syntax, but can be changed via the <CODE>Define</CODE> directive, too. Four internal variables can be used for this. The default is: <BLOCKQUOTE> <PRE> Define mod_define::escape "\\" Define mod_define::dollar "$" Define mod_define::open "{" Define mod_define::close "}" </PRE> </BLOCKQUOTE> <P> When you need to escape some of the expansion constructs you place the mod_define::escape character in front of it. The default is the backslash as in Perl or the Shell. <P> <STRONG>Example:</STRONG> <BLOCKQUOTE> <PRE> Define master "Joe Average <joe@average.dom>" Define docroot /usr/local/apache/htdocs Define hostname foo Define domainname bar.dom Define portnumber 80 : <VirtualHost $hostname.$domainname:$portnumber> SetEnv SERVER_MASTER "$master" ServerName $hostname.$domainname ServerAlias $hostname Port $portnumber DocumentRoot $docroot <Directory $docroot> : <Directory> </PRE> </BLOCKQUOTE> <!--#include virtual="footer.html" --> </BLOCKQUOTE><!-- page indentation --> </BODY> </HTML> <!--/%hypertext -->