[英]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 默认防火墙规则http和https 。
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.