Apache's module mod_env offers a handy way of setting environment variables in configuration files, like:

<VirtualHost *:80>
  ServerName xyz.com
  DocumentRoot /var/www/rails_app/public
  PassengerAppRoot /var/www/rails_app
  SetEnv MY_VARIABLE contents
</VirtualHost>

http://httpd.apache.org/docs/2.0/mod/mod_env.html#setenv

However, in nginx I couldn't find anything that serves the same purpose. What's the alternative here? I thought of setting environment variables in .profile files (I am using Ubuntu 10.04), but that wouldn't have the same "per vHost" isolation I have with Apache, right?

What are the alternatives here?

link|improve this question

40% accept rate
feedback

2 Answers

FastCGI Param for fastcgi passing or Proxy Set Header for when proxy passing.

link|improve this answer
feedback

Why not just create a launcher script that sets the needed enviroment variables before it calls nginx or rails .. and have one scipt per instance?

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.