I have the same problem with you when using a passenger with nginx and nginx init script on ubuntu. The reason is because I use sudo service nginx restart (installed init script) to run nginx and
it was run as root, and root did not receive a user environment variable. There are two solutions for this. One of them starts nginx manually.
sudo service nginx stop sudo -E /path/to/your/nginx
one adds env to your nginx init script
export MC_TEST=true
The latter solution is somehow ugly, but it works. And I think the best way to find the configuration is to tell the init script to save the user interface.
source share