问题描述
我需要将我的 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变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!