In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail the method of setting environment variables in Apache. The content of the article is of high quality, so I hope you can get something after reading this article.
First, there are environment variables controlled by the underlying operating system. These are set before the server starts. They can be used in extensions to configuration files, or they can be passed to CGI scripts and SSI using PassEnv directives.
Second, Apache HTTP Server provides a mechanism for storing information in named variables, also known as environment variables. This information can be used to control various operations, such as logging or access control. Variables are also used as a mechanism for communicating with external programs, such as CGI scripts. This article discusses different ways to manipulate and use these variables.
Although these variables are called environment variables, they are different from the environment variables controlled by the underlying operating system. Instead, these variables are stored and manipulated in the internal Apache structure.
They become actual operating system environment variables only when provided to CGI scripts and when scripts are included on the server side. If you want to manipulate the operating system environment in which the server itself is running, you must use the standard environment operating mechanism provided by the operating system shell.
Set environment variabl
Basic environmental operation
The most basic way to set environment variables in Apache is to use the unconditional SetEnv directive. You can also use the PassEnv directive to pass variables from the shell environment where the server is started.
Conditional per-request settings
To increase flexibility, mod_setenvif provides instructions that allow environment variables to be set on a per-request basis, depending on the characteristics of a particular request.
For example, variables can be set only when a specific browser (user agent) makes a request, or only when a specific Referer [sic] header is found. Greater flexibility can be achieved through mod_rewrite 's RewriteRule, which uses [E =.] Option to set the environment variable.
Unique identifier finally, mod_unique_id sets the environment variable UNIQUE_ID for each request to a value that is guaranteed to be unique among "all" requests under very specific conditions.
Standard CGI variable
In addition to all environment variables set in the Apache configuration and passed from shell, CGI scripts and SSI pages provide a set of environment variables that contain meta-information about requests required by the CGI specification.
Some warnings.
Standard CGI variables cannot be overridden or changed using environment action instructions.
When suexec is used to start the CGI script, the environment is cleared as a set of security variables before starting the CGI script. The list of security variables is defined at compile time in suexec.c.
For portability reasons, the name of an environment variable may contain only letters, numbers, and underscore characters. In addition, the first character may not be a number. When passed to CGI scripts and SSI pages, characters that do not match this limit are replaced by underscores.
A special case is the HTTP header, which is passed to the CGI script and so on through environment variables (see below). They are converted to uppercase, and only dashes are replaced with underscores; if the header contains any other (invalid) characters, the entire header is silently deleted.
The SetEnv directive runs late during request processing, which means that instructions such as SetEnvIf and RewriteCond will not see the variables set with it.
When the server looks up the path through an internal subrequest (such as looking up DirectoryIndex or using mod_autoindex to generate a directory list), the environment variables for each request are not inherited in the subrequest. In addition, because of the API phase of the mod_setenvif action, the SetEnvIf directive is not evaluated separately in the sub-request.
This is how Apache sets environment variables. Is there anything to gain after reading it? If you want to know more about it, you are welcome to follow the industry information. Thank you for reading.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.