env.xml revision aaed4ebc116f5862aff2610a809a9a9e9a28f50e
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco<!DOCTYPE manualpage SYSTEM "/style/manualpage.dtd">
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco<!-- $LastChangedRevision$ -->
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco Licensed to the Apache Software Foundation (ASF) under one or more
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco contributor license agreements. See the NOTICE file distributed with
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco this work for additional information regarding copyright ownership.
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco The ASF licenses this file to You under the Apache License, Version 2.0
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco (the "License"); you may not use this file except in compliance with
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco the License. You may obtain a copy of the License at
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco Unless required by applicable law or agreed to in writing, software
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco distributed under the License is distributed on an "AS IS" BASIS,
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco See the License for the specific language governing permissions and
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco limitations under the License.
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <title>Environment Variables in Apache</title>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <p>There are two kinds of environment variables that affect
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco the Apache HTTP Server.</p>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <p>First, there are the environment variables controlled by
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco the underlying operating system. These are set before the
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco server starts. They can be used in expansions in configuration
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco files, and can optionally be passed to CGI scripts and SSI
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco using the PassEnv directive.</p>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <p>Second, the Apache HTTP Server provides a mechanism for storing
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco information in named variables that are also called <em>environment
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco variables</em>. This information can be used to control various
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco operations such as logging or access control. The variables are
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco also used as a mechanism to communicate with external programs
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco such as CGI scripts. This document discusses different ways to
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco manipulate and use these variables.</p>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <p>Although these variables are referred to as <em>environment
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco variables</em>, they are not the same as the environment
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco variables controlled by the underlying operating system.
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco Instead, these variables are stored and manipulated in an
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco internal Apache structure. They only become actual operating
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco system environment variables when they are provided to CGI
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco scripts and Server Side Include scripts. If you wish to
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco manipulate the operating system environment under which the
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco server itself runs, you must use the standard environment
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco manipulation mechanisms provided by your operating system
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco </modulelist>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <directivelist>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <directive module="mod_setenvif">BrowserMatch</directive>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <directive module="mod_setenvif">BrowserMatchNoCase</directive>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <directive module="mod_env">PassEnv</directive>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <directive module="mod_rewrite">RewriteRule</directive>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <directive module="mod_env">SetEnv</directive>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <directive module="mod_setenvif">SetEnvIf</directive>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <directive module="mod_setenvif">SetEnvIfNoCase</directive>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <directive module="mod_env">UnsetEnv</directive>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco </directivelist>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <p>The most basic way to set an environment variable in Apache
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco is using the unconditional <directive module="mod_env"
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco >SetEnv</directive> directive. Variables may also be passed from
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco the environment of the shell which started the server using the
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <directive module="mod_env">PassEnv</directive> directive.</p>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <title>Conditional Per-Request Settings</title>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <p>For additional flexibility, the directives provided by
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <module>mod_setenvif</module> allow environment variables to be set
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco on a per-request basis, conditional on characteristics of particular
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco requests. For example, a variable could be set only when a
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco specific browser (User-Agent) is making a request, or only when
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco a specific Referer [sic] header is found. Even more flexibility
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco is available through the <module>mod_rewrite</module>'s <directive
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco module="mod_rewrite">RewriteRule</directive> which uses the
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <code>[E=...]</code> option to set environment variables.</p>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <p>Finally, <module>mod_unique_id</module> sets the environment
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco variable <code>UNIQUE_ID</code> for each request to a value which is
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco guaranteed to be unique across "all" requests under very
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco specific conditions.</p>
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco <p>In addition to all environment variables set within the
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco Apache configuration and passed from the shell, CGI scripts and
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco SSI pages are provided with a set of environment variables
d72e314a1952b4418fb1c98b17dbab0d16bba585Adrián Riesco containing meta-information about the request as required by
SetEnvIfNoCase ^Accept.Encoding$ ^(.*)$ fix_accept_encoding=$1
httpd.conf to deal with known client problems. Since the affected clients
# The first directive disables keepalive for Netscape 2.x and browsers that
SetEnvIf Referer "^http://www\.example\.com/" local_referal