Azure + Ubuntu 虚拟机 + 端点

Azure + Ubuntu VM + Endpoints

我可以通过 SSH 连接到我的 Azure VM。但是,端口 80 上的 NGINX 和端口 5000 上的 dockerized ASP.NET Core 都无法访问。我在 Azure 门户配置中添加了安全端点 "allow"。

在 SSH 会话中,使用 lynx 访问 localhost:80 和 localhost:5000 按预期工作

Docker 容器开头为:

docker run -t --rm -p 5000:5000 *imagename*

我试图根据此建议 apache not accepting incoming connections from outside of localhost 修改 IPTABLES,但在 iptables -vL

时仍然显示“0 pkts”

Azure 规则配置的屏幕截图:

我还按照 Rem 的建议添加了端口 80 出站规则,但到目前为止这没有帮助。

在您的 Azure VM 设置中,您应该转到网络安全组 -> 并像这样设置入站安全规则:

1000 default-allow-ssh Any Any SSH (TCP/22) Allow
…
1010 web Any Any HTTP (TCP/80) Allow
1020 web Any Any HTTP (TCP/5000) Allow
…

我还有出站安全规则:

  100 http Any Any Custom (ANY/80) Allow
…

nginx 和您的 docker 容器是否在本地主机或 0.0.0.0 或其他网络接口上绑定?

终于找到答案了。

带圆圈的区域(源端口范围)我有 80 个。将此设置为 * 解决了问题,现在外部连接到 80 工作。 5000 仍然没有,但我希望这是一个 docker 绑定问题,正如 Neil 所建议的那样,我专门使用 nginx 来代理 docker 容器。