phusion passenger not seeing environment variables?

Passenger fusion v4+ enables reading of environment variables directly from bashrc file. Make sure that bashrc lives in the home folder of the user under which passenger process is executed (in my case, it was ubuntu, for ec2 linux and nginx)

Here is the documentation which goes into details of bashrc


I've the same problem with you when use passenger with nginx and nginx init script on ubuntu. The reason is that I use sudo service nginx restart(installed by init script) to start up nginx and
it was running by root and the root did not get your login user environment variable. There are two solutions for this. One is running nginx manually.

sudo service nginx stop
sudo -E /path/to/your/nginx

one is add env to your nginx init script

export MC_TEST=true

The latter solution is somehow ugly, But it works. And I think the better way is found a configuration to tell the init script to preserve the login user env.