I'm trying to set some environment variables to nginx via it's configuration file. I'm using nginx/0.8.53 and it's not working.
server {
listen 80;
server_name localdictus;
root /opt/vdmo_dictus/public; # <--- be sure to point to 'public'!
passenger_enabled on;
rails_env development;
env VDMO_MANDANT = "somevalue";
}
This is the error message:
unknown directive "env" in /opt/nginx/conf/nginx.conf:43
The documentation tells me that there is an "env" command... so what I'm doing wrong ?? http://wiki.nginx.org/CoreModule#env
setting the environment variables via export on the shell is not an option for my application by the way.
Here are the lines:
37: server {
38: listen 80;
39: server_name localdictus;
40: root /opt/vdmo_dictus/public; # <--- be sure to point to 'public'!
41: passenger_enabled on;
42: rails_env development;
43: env VDMO_MANDANT = "somevalue";
44: }
Regards,
Alex
From the documentation you linked to the "Context" for the env directive is main, not server. Put the directive outside of your server { ... } block (outside of any block).
See also this discussion. I do not believe that the env directive does what you are looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With