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.

I have an Ubuntu 12.04 LTS server with a vanilla apache install. In my Apache Config, I'm using PassEnv to pass an environment variable:

PassEnv MY_VARIABLE

MY_VARIABLE is defined in /etc/environment:

MY_VARIABLE=true

If I stop and start apache, the variable is picked up and all is well. However, after reboot, apache does not pick up MY_VARIABLE.

Does Apache start before variables in /etc/environment are set? Is there some other way to accomplish what I'm trying to do?

share|improve this question

1 Answer 1

That is weird ! You can try a cheat by sourcing /etc/environment in /etc/init/d/httpd (not recommended on all occasions)

1) A straight forward solution will be a custom script to launch your apache with your own configuration , you can do all the housekeeping jobs in the script , please use -f to specify your custom httpd.conf file.

2) Alternative : use setEnv to set the required environment variable from httpd.conf itself.

3) Alternative , try to export the required variables from .bashrc.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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