How to use the setEnv variable in apache?

耗尽温柔 提交于 2019-11-27 14:23:51

问题


I need to set my apache environment to 'foobar'

I know I need to set in in my vhost, but what should I type there and where?


回答1:


SetEnv sets a particular variable to some value, so you need something like

SetEnv varname varvalue

If this is for a specific virtual host, and you have access to the Apache configuration files, this would go inside the <VirtualHost> directive for that virtual host.

If you don't have control of the config files, you'll need to put it in a .htaccess file. But for this to work, SetEnv must be allowed in .htaccess files, which is specified using the AllowOverride directive.




回答2:


I came here because I configured a python/django WSGI environment. Loading modules and SetEnv'ing all day long. Did not work. The vars would just not show up.

What did work was this: https://gist.github.com/GrahamDumpleton/b380652b768e81a7f60c

Graham describes how to basically clone your wsgi.py file and then use a different one for each environment (production, test, dev) and setting your environment vars in there with os.environ['whatever'] = 'you like!'



来源:https://stackoverflow.com/questions/3638637/how-to-use-the-setenv-variable-in-apache

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!