如何在Apache中使用setEnv变量? [英] How to use the setEnv variable in apache?

查看:155
本文介绍了如何在Apache中使用setEnv变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将我的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆