Question about the env

Igor Sysoev igor at
Fri Nov 12 22:18:54 MSK 2010

On Fri, Nov 12, 2010 at 02:09:11AM -0500, speedfirst wrote:

> Hey, I noticed that the "env" directive in the main module is not an
> equivalent of "export" in bash or "putenv" in C stdlib. The variables
> defined by "env" seems only can be used by the embeded Perl module,
> right? 

Not only.
For example, "env OPENSSL_ALLOW_PROXY_CERTS=1;" controls OpenSSL.
"env MALLOC_OPTIONS;" controls FreeBSD malloc().

> The wiki doc for this directive is a little hard to understand. Let's
> make it simple. In which cases, the variables defined by "env" can be
> considered equivalent to the variables in bash?

By default, nginx wipes all its environment variables expect TZ variable.
"env NAME" allows to keep NAME variable value got from parent process,
i.e., shell. "env NAME=val" sets NAME variable value.

Igor Sysoev

More information about the nginx mailing list