简体   繁体   English

Ubuntu + Nginx-尝试安装GeoIP模块

[英]Ubuntu + nginx - trying to install GeoIP module

I'm using vagrant (VVV actually) to run local wordpress installs. 我正在使用无业游民(实际上是VVV)来运行本地wordpress安装。 I want to test different behaviors for different GEO's on my local machine instead of upload it every time to the server which is annoying. 我想在本地计算机上针对不同的GEO测试不同的行为,而不是每次都将其上载到服务器上,这很烦人。

So, I've tried to install the GeoIP nginx module to the local machine with the following guide https://piwik.org/faq/how-to/faq_166/ (and a bit more google but it doesn't matter at the moment). 因此,我尝试使用以下指南https://piwik.org/faq/how-to/faq_166/将GeoIP nginx模块安装到本地计算机上(还有更多的google,但在时刻)。

When I'm using ./configure the following is exists: 当我使用./configure ,存在以下内容:

checking for GeoIP library ... found
checking for GeoIP IPv6 support ... found

I've also set the .dat files in my conf file, and set the $_SERVER (fastcgi_param) parameters - so they displayed when I'm printing the $_SERVER var. 我还在conf文件中设置了.dat文件,并设置了$_SERVER (fastcgi_param)参数-在打印$_SERVER var时将显示它们。

But those GeoIP vars are empty. 但是那些GeoIP变量是空的。 I'm not sure about the reason, but 2 things is bothering me. 我不确定原因,但是有两件事困扰着我。 First, when I'm write nginx -V in the terminal the argument --with-http_geoip_module is missing. 首先,当我在终端中写入nginx -V ,缺少--with-http_geoip_module参数。 Second, could it actually works if the REMOTE_ADDR (IP) is not my real IP? 其次,如果REMOTE_ADDR (IP)不是我的真实IP,它真的可以工作吗? (192.168.1.50 for example). (例如192.168.1.50)。

nginx is a bit strange for me, so sorry if something isn't exact.. nginx对我来说有点奇怪,如果不正确,请对不起。

-- -

Operating system - macOS, nginx version - 1.3.15, running with VVV (vagrant box) 操作系统-macOS,nginx版本-1.3.15,运行VVV(无用盒)

If there is a reverse proxy in front of your nginx, use geoip_proxy to set IPs whose X-Forwarded-For-Header can be trusted. 如果您的nginx前面有一个反向代理,请使用geoip_proxy设置可以信任其X-Forwarded-For-Header的IP。

You can also use that without actually having a reverse proxy when you're developing. 在开发时,也可以在没有反向代理的情况下使用它。 Add your local IP to the geoip_proxy-list and set the X-Forwarded-For -Header to your public IP in your browser (use a plugin like Modify Headers). 将您的本地IP添加到geoip_proxy-list中,并将X-Forwarded-For -Header设置为浏览器中的公共IP(使用诸如Modify Headers之类的插件)。

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

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