代理不再识别真实IP

这对我不起作用。

我现在明白为什么从引用的提交开始它对我停止工作了;它破坏了我多年来一直使用的 set_real_ip 替换。使其更稳健的理由是合理的,这是一个更好的方案;一次破坏性变更,之后应该更少出现中断。

我不知道为什么 after_bundle_exec 替换没有生效,但我打算改为直接放入文件。

这对我有效;分享给下一个人:

run:
  - file:
     path: /etc/nginx/conf.d/outlets/server/real-ip-recursive.conf
     chmod: 644
     contents: |
       real_ip_recursive on;
  - file:
     path: /etc/nginx/conf.d/outlets/server/real-ip-header.conf
     chmod: 644
     contents: |
       real_ip_header X-Forwarded-For;
  - file:
     path: /etc/nginx/conf.d/outlets/server/set-real-ip-from.conf
     chmod: 644
     contents: |
       set_real_ip_from 192.168.0.0/16;
       set_real_ip_from 172.16.0.0/12;
       set_real_ip_from 10.0.0.0/8;