Compute Engine : "This site can’t be reached"
Asked Answered
S

5

29

SITUATION:

I am following this tutorial.

When I get to the part where I create an instance and I execute the necessary commands, I get to the following:

To see the application running, go to http://[YOUR_INSTANCE_IP]:8080,

where [YOUR_INSTANCE_IP] is the external IP address of your instance.

PROBLEM:

The page deosn't load. I get the following error message:

This site can’t be reached

QUESTION:

What could have gone wrong ?

All previous steps worked perfectly and I was able to access my website locally.

I waited for the Compute Engine instance to be ready by checking:

gcloud compute instances get-serial-port-output my-app-instance --zone us-central1-f 

and although I reproduced all the steps twice, I am still met with the error message.

Something must be missing.


EDIT:

My firewall rules:

enter image description here

Shylashylock answered 7/2, 2017 at 19:10 Comment(19)
Can you SSH in your server and verify that a service is listening on port 8080? i.e. netstat --listen I would also check that your server is using the tag “http-server”. You can run “gcloud compute instances describe”Abdul
@Abdul It does not seem to listen for port 8080. At least "8080" does not appear anywhere in the output of the command netstat --listenShylashylock
Ok, at least we know the service is down. Did you get any errors in the serial console? Does it show the startup script run successfully and installed the applications?Abdul
@Abdul There is a LOT of data in the logs, but couldn't see any error. The startup script seems to have been run without issues. If you have an email address, I can send you the logs.Shylashylock
I am following the tutorial, but at the moment I am getting some errors running "npm Install". So no luck yet running it locally. I will post any updates.Abdul
@Abdul Great, thx !Shylashylock
Did this command "gcloud compute instances get-serial-port-output my-app-instance --zone us-central1-f" return the success as discussed in the tutorial (i.e.: "Finished running startup script")?Jessy
@Sanity1123 It did.Shylashylock
Not sure then, I think that would be the only thing that would cause you to get the error that you are getting. And when you ran it locally, downloading the node packages and running localhost:8080 - did that work too?Jessy
@Sanity1123 Of course.Shylashylock
You might have to contact google cloud support for assistance then. Reading through the tutorial it seems like everything should work if followed correctly - and in your case, this is the case.Jessy
@Sanity1123 I have been in contact with the Google Cloud Support sine I created this question.Shylashylock
There is a request to review the document. There are some errors while trying to even run the example locally.Abdul
@Shylashylock Were you able to resolve this problem? If so, please provide the resolution as a self-answer which will also help the community having similar issue.Hiltner
What IP did you try to connect to? Make sure that it is an external IP. Check it out in your GCP console at VPC network > External IP addresses to see if you have associated an external IP address with your instance.Postimpressionism
Also make sure your instance has been tagged as http-server.Postimpressionism
Try restarting the httpd and see the lof files of httpd for help.Lychnis
How about if you add your own ip to the ip range just to make sure the problem is not there. Otherwise, make sure your instance is connected to internet ! ((I don't know why it shouldn't but double check))Downstage
Anyone an update on this one? I have EXACTLY the same issue and have done exactly the same. The docs are not good on this one.Ghislainegholston
A
2

I guess you don't apply firewall tag to instance ?

First, you can check your compute instences tags.

gcloud compute instances describe my-app-instance

In your example , you should see http-server in tags-items, like follows

tags:
  fingerprint: xxxxxxx
  items:
  - http-server
  - https-server

If not exist, you should add the tags to an existing VM instance, use this gcloud command:

gcloud compute instances add-tags [YOUR_INSTANCE_NAME] --tags http-server,https-server

To add the tags at the time of the instance creation, include that flag in your statement:

gcloud compute instances create [YOUR_INSTANCE_NAME] --tags http-server,https-server
Anterior answered 15/1, 2019 at 2:41 Comment(0)
D
0

If your code and firewall rules are correct then it's highly possible that you are trying to connect to wrong IP. You should be using external IP, not internal one which you get using ifconfig, you can get your external IP at whatsmyip.com

Detent answered 7/11, 2017 at 10:42 Comment(0)
D
0

I will suggest looking into this step:

gcloud compute instances create my-app-instance \
--image-family=debian-9 \
--image-project=debian-cloud \
--machine-type=g1-small \
--scopes userinfo-email,cloud-platform \
--metadata app-location=$BOOKSHELF_DEPLOY_LOCATION \
--metadata-from-file startup-script=gce/startup-script.sh \
--zone us-central1-f \
--tags http-server

Please ensure the instance is created with the http-server tag

Otherwise, the firewall rules will not take effect on your instance

gcloud compute firewall-rules create default-allow-http-8080 \
--allow tcp:8080 \
--source-ranges 0.0.0.0/0 \
--target-tags http-server \
--description "Allow port 8080 access to http-server"
Dielle answered 4/10, 2019 at 6:39 Comment(0)
S
0

First, check if the firewall settings are correct as the others had mentioned.

Second, I was having the same problem and solve it by selecting on the Network Service Tier section the "Standard" option instead of the "Premium" one.

Third, check if there is another application running on the same port using the command:

netstat -tulpn

Which should return something like:

(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp6       0      0 :::80                   :::*                    LISTEN      -

In my case it was not working because I had two applications running on the same port.

Squawk answered 23/4, 2021 at 7:40 Comment(0)
K
0

This problem can be solved by allowing "http traffic" in the firewall rules.

To add firewall rules you have to open the instance and then edit it. enter image description here

Kymry answered 30/12, 2023 at 10:0 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.