Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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: https://github.com/JasonGiedymin/nginx-init-ubuntu/blob/master/nginx 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 has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

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.