~Onlooker 2011-11-11 19:27 采纳率: 0%
浏览 235
已采纳

变量类似于 Apache 中的 SetEnv?

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

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?

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

  • I use the same app for many domains. All data comes from different databases with the same structure.
  • The database name is hardcoded to the virtual host, in that environmental variable.
  • As I know the database name, all the queries go to its appropriate database, from the very first query.
  • I can have multiple domains using the same database, just including the same variable into the directives.

转载于:https://stackoverflow.com/questions/8098927/nginx-variables-similar-to-setenv-in-apache

  • 写回答

4条回答 默认 最新

  • 谁还没个明天 2011-11-11 19:50
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料