简体   繁体   English

谷歌云计算引擎 http 连接超时

[英]Google Cloud Compute Engine http Connection Timeout

I have setup a compute engine VM with 2vCPU and 2GB RAM.I have setup nginx server and setup the firewalls permissions as shown in the diagram.我已经设置了一个具有 2vCPU 和 2GB RAM 的计算引擎 VM。我已经设置了 nginx 服务器并设置了防火墙权限,如图所示。 When I try to access the angular files hosted on the server using the external IP I get the error " The connection has timed out " and when I try to use curl on the terminal, it displays the error " curl: (28) Failed to connect to IP port 80 after 129163 ms: Connection timed out ".当我尝试使用外部 IP 访问服务器上托管的 angular 文件时,出现错误“连接超时”,当我尝试在终端上使用 curl 时,它显示错误“ curl: (28) Failed to在 129163 毫秒后连接到 IP 端口 80:连接超时”。 在此处输入图像描述

Both the Http and Https firewall rules are enabled Http 和 Https 防火墙规则均已启用在此处输入图像描述 Whe I run the command当我运行命令时

sudo systemctl status apache2

This is the result I get这是我得到的结果在此处输入图像描述

netstat -tulpn | grep LISTEN

在此处输入图像描述

enter code here

Any ideas on what the issue might be will be really helpful关于问题可能是什么的任何想法都会非常有帮助

Your problem is probably that you forgot to enable the Compute Engine VM network tags which attach firewall rules to.network interfaces.您的问题可能是您忘记启用将防火墙规则附加到网络接口的 Compute Engine VM网络标签

The Compute Engine edit screen has checkboxes where you can select the default firewall rules http and https .计算引擎编辑屏幕有复选框,您可以在其中设置 select 默认防火墙规则httphttps

Configuring.network tags配置.network标签

Verify that Apache is running without errors.验证 Apache 是否正常运行。 This example is for Debian/Ubuntu distributions.此示例适用于 Debian/Ubuntu 发行版。

sudo systemctl status apache2

Verify that Apache is listening on ports 80 and 443 for.network interfaces.验证 Apache 是否正在侦听端口 80 和 443 for.network 接口。 You should see 0.0.0.0 or :::80 and :::443 in the output. If you see 127.0.0.1 or ::1 for port 80/443 then Apache is configured to listen for internal traffic only.您应该在 output 中看到0.0.0.0或 :: :::80和 :: :::443 。如果您在端口 80/443 中看到127.0.0.1::1 ,则 Apache 配置为仅侦听内部流量。

netstat -tulpn | grep LISTEN

Verify that the Linux firewall UFW is not installed or blocking ports.验证 Linux 防火墙 UFW 是否未安装或阻止端口。

ufw status

Your domain might be one that is preconfigured to redirect in the browser to HTTPS. That means you must enable port 443 for connections.您的域可能是预先配置为在浏览器中重定向到 HTTPS 的域。这意味着您必须为连接启用端口 443。 However, curl is not affected by that rule so that is not yet a problem but might be once you get port 80 open.但是,curl 不受该规则的影响,因此这还不是问题,但一旦打开 80 端口就可能成为问题。

If none of those checks solve your problem, edit your question with details on how your VM is configured and how Linux/Apache are setup.如果这些检查都不能解决您的问题,请使用有关如何配置 VM 以及如何设置 Linux/Apache 的详细信息来编辑您的问题。 Include the results of each one of my tests.包括我的每一项测试的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 谷歌云计算引擎实例连接失败 flask - Google cloud compute engine instance connection failed with flask 无法访问谷歌云计算引擎上的 Jenkins - Unable to access Jenkins on compute engine on google cloud 无法 SSH 进入我在 Google Cloud 上的 Compute Engine 虚拟机实例 - Unable to SSH into my Compute Engine VM instance on Google Cloud 无法使用 sshtunnel 将 SSH 发送到 Google Cloud Compute Engine - Can't SSH to Google Cloud Compute Engine with sshtunnel 安装在 Google Cloud Compute Engine 上时启动 Nifi GUI - Initiating Nifi GUI when installed on Google Cloud Compute Engine 来自计算引擎的谷歌云平台免费套餐限制 - Google cloud platform free tier limits from compute engine 如何将现有的 Compute Engine 用于 Google Cloud Build? - How to use existing Compute Engine for Google Cloud Build? http api 在谷歌云上使用应用引擎或云 function - http api on google cloud using app engine or cloud function 无法使用 Cloud SQL 代理从 Google Compute Engine 连接到 Google Cloud SQL - Can't connect to Google Cloud SQL from Google Compute Engine with Cloud SQL Proxy 如何将文件从谷歌云计算引擎(linux 终端)复制到谷歌云 shell? - How can I copy files from a Google Cloud Compute engine(linux terminal) to google cloud shell?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM