简体   繁体   English

Nginx + Passenger + GeoIP:无法将变量值传递给应用程序

[英]Nginx + Passenger + GeoIP: Can't pass variable value to application

So I'm installing a new server with Nginx v. 1.8, Rails 4.2 and Paasenger v. 5.0.21 and I'm trying to send GeoIP variables to the application this way: 因此,我正在使用Nginx v。1.8,Rails 4.2和Paasenger v。5.0.21安装新服务器,并且尝试通过这种方式将GeoIP变量发送到应用程序:

passenger_env_var HTTP_GEOIP_COUNTRY_CODE US;
passenger_env_var HTTP_GEOIP_VISITING_COUNTRY $geoip_country_code;

The first variable is correctly defined in the ENV hash in the application, but the second variable is set to "$geoip_country_code" instead of the country code detected by the GeoIP library. 第一个变量已在应用程序的ENV哈希中正确定义,但第二个变量设置为“ $ geoip_country_code”,而不是GeoIP库检测到的国家/地区代码。

I know that GeoIP is properly configured because I created a log_format and logged the value of the $geoip_country_code variable, with favorable results. 我知道GeoIP已正确配置,因为我创建了log_format并记录了$ geoip_country_code变量的值,并获得了令人满意的结果。

Does anybody know the right way to pass a Nginx variable as a Passenger Env Var? 有谁知道将Nginx变量作为乘客环境变量传递的正确方法吗?

Thanks. 谢谢。

Github上已经回答了这个问题: https : //github.com/phusion/passenger/issues/1664

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM