如何在Apache中使用setEnv变量? [英] How to use the setEnv variable in apache?
问题描述
我需要将我的Apache环境设置为'foobar'
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?
推荐答案
SetEnv
将特定变量设置为某个值,因此您需要类似
SetEnv
sets a particular variable to some value, so you need something like
SetEnv varname varvalue
如果这是用于特定的虚拟主机,并且您有权访问Apache配置文件,则该文件将位于该虚拟主机的<VirtualHost>
指令中.
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.
如果您无法控制配置文件,则需要将其放在.htaccess
文件中.但是,要使其正常工作,必须在.htaccess
文件中允许使用SetEnv
,该文件是使用 AllowOverride
指令.
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.
这篇关于如何在Apache中使用setEnv变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!