Nginx的变量类似于阿帕奇SETENV? [英] Nginx variables similar to SetEnv in Apache?

查看:238
本文介绍了Nginx的变量类似于阿帕奇SETENV?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用SETENV在Apache来设置virtualhosts一些变量,我使用PHP中恢复 $ _ SERVER [the_variable]

I use SetEnv in Apache to set some variables in virtualhosts that I recover in PHP using $_SERVER[the_variable].

现在,我切换到Perl的催化剂和Nginx的,但它似乎在Nginx的了ENV指令是不一样的。这是行不通的。怎样才可以实现呢?

Now I am switching to Perl Catalyst and Nginx, but it seems that the "env" directive in Nginx is not the same. It does not work. How can it be accomplished?

下面是背景图片,以防万一有人可以提出一个更好的方法或我的previous系统不Nginx的工作。

Here is the background picture, just in case someone can suggest a better approach or my previous system does not work with Nginx.


  • 我用的是相同的应用程序的诸多领域。所有的数据来自具有相同的结构不同的数据库。

  • 数据库名称是硬coded到虚拟主机,在该环境变量。

  • 当我知道数据库的名称,所有的查询到其相应的数据库,从最初的查询。

  • 我可以使用相同的数据库,只是包括相同的变量进入指令多个域。

推荐答案

像Apache没有nginx的不能管理你的后端进程,所以也不会影响他们的环境。要设置从nginx的一个新的$ _SERVER PHP变量,你需要与他们的其余部分一起添加新fastcgi_param条目。无论你是包括fastcgi_params或fastcgi.conf。

nginx doesn't manage your backend processes like apache does, so it can't affect their environments. To set a new $_SERVER php variable from nginx, you need to add a new fastcgi_param entry along with the rest of them. Wherever you're including fastcgi_params or fastcgi.conf.

这篇关于Nginx的变量类似于阿帕奇SETENV?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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