I use SetEnv in Apache to set some variables in virtualhosts that I recover in PHP using $_SERVER[the_variable]
.
Now I am switching to Perl Catalyst and Nginx, but it seems that the "env" directive in Nginx is not the same. It does not work. How can it be accomplished?
Here is the background picture, just in case someone can suggest a better approach or my previous system does not work with Nginx.
SetEnv DirectiveSets an internal environment variable, which is then available to Apache HTTP Server modules, and passed on to CGI scripts and SSI pages.
Out-of-the-box, nginx doesn't support environment variables inside most configuration blocks. But envsubst may be used as a workaround if you need to generate your nginx configuration dynamically before nginx starts.
location / { ... fastcgi_param APPLICATION_ENV production; fastcgi_param APPLICATION_CONFIG user; ... }
but it's for PHP-CGI
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