« perl生成二维码的方法 | (回到Blog入口) | hypnotoad workers参数对并发的影响 »

Movable type通过反向代理无法获取真实IP

前端使用了NGINX反向代理,结果发现log里面的ip地址都是127.0.0.1,在网上找了一圈没找到结果,后来看了下源码,发现配置文件中有个 TransparentProxyIPs的变量,当这个设置为真的时候,就从X-Forwarded-For里面获取IP。 如下:

my $ip = $trusted ? $app->getheader(‘X-Forwarded-For’) : $remoteip;

官网的说明

  • If your webserver is behind an HTTP proxy, it will look as if all comments and trackback pings are coming from the same IP address, making it difficult (nay, impossible) to ban any particular sender’s IP address。

剩下的就很简单了,在mt-config.cgi中加入

TransparentProxyIPs 1

重启perl的相关服务,一切就OK了

引用通告

TrackBack URL for this entry:
如果您想引用这篇文章到您的Blog,
请复制下面的链接,并放置到您发表文章的相应界面中。
http://playcat.net/mt-tb.cgi/130

发表一个评论

(如果你此前从未在此 Blog 上发表过评论,则你的评论必须在 Blog 主人验证后才能显示,请你耐心等候。)

关于

此页面包含了发表于2016年10月21日 16:09的 Blog 上的单篇日记。

此 Blog 的前一篇日记是 perl生成二维码的方法

此 Blog 的后一篇日记是 hypnotoad workers参数对并发的影响

更多信息可在 主索引 页和 归档 页看到。

Creative Commons License
此 Blog 中的日记遵循以下授权 Creative Commons(创作共用)授权.
Powered by
Movable Type 6.3.2