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.

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

1 Answer 1

You already mentioned the docs. There it is: http://httpd.apache.org/docs/2.2/mod/mod_env.html

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

share|improve this answer
1  
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

 
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.