连接到 Compute Engine 上托管的服务不起作用 - 无法访问站点/我添加了 http(s) 标签
Connecting to service hosted on Compute Engine not working - Site cannot be reached / I have added the http(s) tags
团队,需要快速帮助!我在 GCP 的计算引擎上创建并托管了服务。这是在 Ubuntu 服务器上,在创建实例时,我确定启用了 allow-HTTP && allow-HTTPS 标志。但是,我仍然无法从外部连接到该服务。
我已经在端口 4000 上公开了服务,但是 tcp:80 应该允许 HTTP 流量进入。我有点绕圈子没有结果。
正如您在问题中提到的:
While creating the instance, I have made
sure, allow-HTTP && allow-HTTPS flag was enabled.
根据文档 Creating and starting a VM instance section Creating an instance from a public image:
- Select
Allow HTTP traffic
or Allow HTTPS traffic
to permit HTTP or HTTPS traffic to the VM. When you select one of these, Compute Engine
adds a network tag to your VM, which associates the firewall rule with
the VM. Then, Compute Engine creates the corresponding ingress
firewall rule that allows all incoming traffic on tcp:80 (HTTP) or
tcp:443 (HTTPS).
因此,您启用了到端口 80 和 443 的实例入口连接,其他端口将关闭,ports opened by default rules.
除外
另一方面,您有一个侦听端口 4000 的应用程序:
I have exposed the service on port 4000
因此,您无法通过 http://EXTERNAL_IP_OF_YOUR_VM_INSTANCE:4000
访问您的应用程序,因为您没有打开 @John Hanley 提到的端口 4000在评论中。
有两种方法可以解决您的问题:
- 更改应用程序的设置以在端口 80 上公开它
- 遵循文档 Using firewall rules and create a new firewall rule to allow ingress traffic to your VM instance on the port 4000 through the Console or via command line。
团队,需要快速帮助!我在 GCP 的计算引擎上创建并托管了服务。这是在 Ubuntu 服务器上,在创建实例时,我确定启用了 allow-HTTP && allow-HTTPS 标志。但是,我仍然无法从外部连接到该服务。
我已经在端口 4000 上公开了服务,但是 tcp:80 应该允许 HTTP 流量进入。我有点绕圈子没有结果。
正如您在问题中提到的:
While creating the instance, I have made sure, allow-HTTP && allow-HTTPS flag was enabled.
根据文档 Creating and starting a VM instance section Creating an instance from a public image:
- Select
Allow HTTP traffic
orAllow HTTPS traffic
to permit HTTP or HTTPS traffic to the VM. When you select one of these, Compute Engine adds a network tag to your VM, which associates the firewall rule with the VM. Then, Compute Engine creates the corresponding ingress firewall rule that allows all incoming traffic on tcp:80 (HTTP) or tcp:443 (HTTPS).
因此,您启用了到端口 80 和 443 的实例入口连接,其他端口将关闭,ports opened by default rules.
除外另一方面,您有一个侦听端口 4000 的应用程序:
I have exposed the service on port 4000
因此,您无法通过 http://EXTERNAL_IP_OF_YOUR_VM_INSTANCE:4000
访问您的应用程序,因为您没有打开 @John Hanley 提到的端口 4000在评论中。
有两种方法可以解决您的问题:
- 更改应用程序的设置以在端口 80 上公开它
- 遵循文档 Using firewall rules and create a new firewall rule to allow ingress traffic to your VM instance on the port 4000 through the Console or via command line。