Home > other >  Google Cloud Compute Engine http Connection Timeout
Google Cloud Compute Engine http Connection Timeout

Time:05-07

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. 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".enter image description here

Both the Http and Https firewall rules are enabled enter image description here Whe I run the command

sudo systemctl status apache2

This is the result I get enter image description here

netstat -tulpn | grep LISTEN

enter image description here

enter code here

Any ideas on what the issue might be will be really helpful

CodePudding user response:

Your problem is probably that you forgot to enable the Compute Engine VM network tags which attach firewall rules to network interfaces.

The Compute Engine edit screen has checkboxes where you can select the default firewall rules http and https.

Configuring network tags

Verify that Apache is running without errors. This example is for Debian/Ubuntu distributions.

sudo systemctl status apache2

Verify that Apache is listening on ports 80 and 443 for network interfaces. 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.

netstat -tulpn | grep LISTEN

Verify that the Linux firewall UFW is not installed or blocking ports.

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. However, curl is not affected by that rule so that is not yet a problem but might be once you get port 80 open.

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. Include the results of each one of my tests.

  • Related