Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I am using Nginx with Passenger to serve a Rails app. I have hit a strange problem where NginX is not reading the environment variables that the app needs when started normally by the init script. I am using this script: When NginX starts via the script the environment variables are not set. If I stop the server, and then restart it manually by doing:

-E /opt/nginx/sbin/nginx

then the environment variables are set. My question is how do I get the init script to do this as well?

share|improve this question

marked as duplicate by quanta, mgorven, Ward, Khaled, mdpc Feb 27 '13 at 5:28

This question was marked as an exact duplicate of an existing question.

Try adding the variables to the script

export VAR='/blah'

share|improve this answer
This won't work because the only reference I have for the variable is the variable itself (I don't want to hard code values in an init script), and they are not being passed in. So I would have to do export VAR=$VAR The environment variables are being set in /etc/environment – i0n Feb 26 '13 at 1:00

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