My question is how to pass the system environment variable to nginx.conf?
I define a system variable CLASSPATH in /etc/profile:
export CLASSPATH=$CLASSPATH:$HADOOP_HOME/bin/hadoop classpath --glob
And I define tow variables in nginx.conf:
env TEST_ENV=/usr/local/test;
env $CLASSPATH;
and print the variables by lua:
location /lua {
default_type text/html;
content_by_lua '
ngx.say(os.getenv("TEST_ENV"));
ngx.say(os.getenv("CLASSPATH"));
';
}
The results as below:
ngx.say(os.getenv("TEST_ENV")); ====> /usr/local/test
ngx.say(os.getenv("CLASSPATH")); ====> nil
Looks the env directive can't pass the system value to nginx.conf
Any suggestion?