Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

How can I set an environment variable (not an "Apache environment variable", as described in the Apache HTTP server documentation here, but a plain old operating system environment variable) for processes spawned by Apache HTTP server?

I have a Flask WSGI application for which I would like to have an environment variable set for the user www-data under which the HTTP server runs.

This is basically the same as the question How to set an environment variable for a process spawned by the webserver?, except for Apache HTTP server.

share|improve this question

You already mentioned the docs. There it is:

Look for the SetEnv. It is exactly what you requested.

share|improve this answer
No, SetEnv isn't necessarily what they are after. Whether that is of any use depends on how they are hosting their WSGI application with Apache. May do what is wanted with CGI, but will not with mod_wsgi or mod_python. Can't remember what happens with mod_fastcgi and mod_fcgi and a FASTCGI/WSGI adapter. OP needs to state what WSGI hosting mechanism they are using. – Graham Dumpleton Jul 30 '11 at 6:36

Your Answer


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.