# 用户IP地址显示为服务器IP

**URL:** <https://meta.discourse.org/t/ip-address-of-users-showing-as-server-ip/139057>\
**Category:** Self-hosting\
**Created:** [2020年一月19日 00:04 UTC](https://meta.discourse.org/t/ip-address-of-users-showing-as-server-ip/139057 "2020-01-19T00:04:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![GoActuary](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/goactuary/32/166930_2.png) [@GoActuary](https://meta.discourse.org/u/GoActuary)\
**Post date:** [2020年一月19日 00:04 UTC](https://meta.discourse.org/t/ip-address-of-users-showing-as-server-ip/139057/1 "2020-01-19T00:04:38Z")

</div>

你好，  
我们新安装了一个 Discourse（顺便说一句，谢谢）。当我在管理面板中查看用户地址时，所有用户显示的 IP 地址都是服务器的 IP，而不是用户的 IP。  
您觉得我应该从哪里开始排查？

---

<div class="post-metadata">

**Author:** ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)\
**Post date:** [2020年一月19日 01:32 UTC](https://meta.discourse.org/t/ip-address-of-users-showing-as-server-ip/139057/2 "2020-01-19T01:32:07Z")

</div>

这表明您的安装中存在反向代理。您的服务器是如何安装的？

您是否在使用 Cloudflare？

---

<div class="post-metadata">

**Author:** ![stanski](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stanski](https://meta.discourse.org/u/stanski)\
**Post date:** [2020年一月19日 19:48 UTC](https://meta.discourse.org/t/ip-address-of-users-showing-as-server-ip/139057/3 "2020-01-19T19:48:16Z")

</div>

你好，Stephen，你说得对——这是一个反向代理安装。真实 IP 是通过不同的请求头发送给 Docker 中的 nginx 的。  
有没有办法将用户的 IP 地址与新请求头匹配，而不是默认的 remote\_addr？

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2020年一月21日 04:48 UTC](https://meta.discourse.org/t/ip-address-of-users-showing-as-server-ip/139057/4 "2020-01-21T04:48:49Z")

</div>

查看 [Set up Discourse on a server with existing Apache sites](https://meta.discourse.org/t/how-to-set-up-discourse-on-a-server-with-existing-apache-sites/30013)

---

<div class="post-metadata">

**Author:** ![GoActuary](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/goactuary/32/166930_2.png) [@GoActuary](https://meta.discourse.org/u/GoActuary)\
**Post date:** [2020年一月23日 02:10 UTC](https://meta.discourse.org/t/ip-address-of-users-showing-as-server-ip/139057/5 "2020-01-23T02:10:44Z")

</div>

谢谢，成功了。[已解决]

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2022年十二月14日 15:38 UTC](https://meta.discourse.org/t/ip-address-of-users-showing-as-server-ip/139057/6 "2022-12-14T15:38:19Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
