# Dial tcp IPaddress:80 getsockopt 连接被拒绝

**URL:** <https://meta.discourse.org/t/dial-tcp-ipaddress-80-getsockopt-connection-refused/203146>\
**Category:** Support\
**Tags:** tablet\
**Created:** [2021年九月10日 09:29 UTC](https://meta.discourse.org/t/dial-tcp-ipaddress-80-getsockopt-connection-refused/203146 "2021-09-10T09:29:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Viki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/viki/32/131139_2.png) [@Viki](https://meta.discourse.org/u/Viki)\
**Post date:** [2021年九月10日 09:29 UTC](https://meta.discourse.org/t/dial-tcp-ipaddress-80-getsockopt-connection-refused/203146/1 "2021-09-10T09:29:41Z")

</div>

您好，

我在 GCP 虚拟机实例（Ubuntu Server）上按照官方文档（30 分钟快速指南）安装了 Discourse。  
我遇到了以下问题：dial tcp myIPaddress:80 getsockopt connection refused。  
恳请提供解决方案。

---

<div class="post-metadata">

**Author:** ![IAmGav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamgav/32/235598_2.png) [@IAmGav](https://meta.discourse.org/u/IAmGav)\
**Post date:** [2021年九月10日 09:46 UTC](https://meta.discourse.org/t/dial-tcp-ipaddress-80-getsockopt-connection-refused/203146/2 "2021-09-10T09:46:32Z")

</div>

您需要设置域名 DNS，将其指向 Discourse 的安装位置。

---

<div class="post-metadata">

**Author:** ![Viki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/viki/32/131139_2.png) [@Viki](https://meta.discourse.org/u/Viki)\
**Post date:** [2021年九月10日 09:47 UTC](https://meta.discourse.org/t/dial-tcp-ipaddress-80-getsockopt-connection-refused/203146/3 "2021-09-10T09:47:53Z")

</div>

我已将服务器的外部 IP 地址指向 DNS 中的 A 记录。

---

<div class="post-metadata">

**Author:** ![IAmGav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamgav/32/235598_2.png) [@IAmGav](https://meta.discourse.org/u/IAmGav)\
**Post date:** [2021年九月10日 10:44 UTC](https://meta.discourse.org/t/dial-tcp-ipaddress-80-getsockopt-connection-refused/203146/4 "2021-09-10T10:44:40Z")

</div>

那么，您需要查看 GCP 中的网络配置。

---

<div class="post-metadata">

**Author:** ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)\
**Post date:** [2021年九月10日 11:32 UTC](https://meta.discourse.org/t/dial-tcp-ipaddress-80-getsockopt-connection-refused/203146/5 "2021-09-10T11:32:34Z")

</div>

在创建虚拟机时，您是否同时启用了 HTTP 流量和 HTTPS 流量？如果没有，您需要启用它们，并开放相应的防火墙规则以允许这些流量通过。

---

<div class="post-metadata">

**Author:** ![Viki](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/viki/32/131139_2.png) [@Viki](https://meta.discourse.org/u/Viki)\
**Post date:** [2021年九月11日 15:35 UTC](https://meta.discourse.org/t/dial-tcp-ipaddress-80-getsockopt-connection-refused/203146/6 "2021-09-11T15:35:29Z")

</div>

感谢 @IAmGav 和 @itsbhanusharma。  
我已创建外部静态 IP 地址并将其指向 VM 实例。现在可以正常工作了。

---

<div class="post-metadata">

**Author:** ![IAmGav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamgav/32/235598_2.png) [@IAmGav](https://meta.discourse.org/u/IAmGav)\
**Post date:** [2021年九月11日 16:27 UTC](https://meta.discourse.org/t/dial-tcp-ipaddress-80-getsockopt-connection-refused/203146/7 "2021-09-11T16:27:07Z")

</div>

很高兴它已正常运行。

祝您使用 Discourse 愉快 😊
