Google Cloud VM refused to connect

I set up an Ubuntu VM running Ghost on Google Cloud free tier, adding a static IP to the VM. Ghost is running, no error, but the external IP refuses to connect. I tried to open port 80 in addition to 443. Is there anything else I should do to fix it?

Depends on your setup, so many different variables . If you can specify how you setup the environment it would be easier to understand . Did you follow the official doc ?
Initial things to check:

  • Are your ports listening? You can netstat -a to find out.
  • Are you able to connect locally within the host? You can try to ‘curl’ to Ghost and/or Nginx if you have one.
  • When you say ‘refuses to connect’ what behavior are you observing? Just a blank page? 502,503 status codes? Any other message?

Hi, I simply done this:

  • create an account
  • create a project
  • start a VM with ubuntu 20.04 lts (standard disk), allowing both http and https traffic
  • reserved a static ip for the vm
  • installing ghost on ubuntu (following official doc)
  • adding a swap file

I did it two times, the first using Cloudflare SSL certificate, the second with Letsencrypt. Same error. If I visit the ip it refuses connection on https and say nginx works on https. dns still not propagated.

It would be helpful to provide site name, IP, error screenshot, etc. Also I don’t understand what you mean by “and say nginx works on https. dns still not propagated.”

but it’s now behind cloudflare, so it shouldn’t be reachable via ip address
Cloudflare is set to proxy the ip and have ssl set to full(strict).
When visiting the site, now I get error 521, website down, but it’s up and running at port 2368.

I really don’t have any other idea of what it can be.

I clicked on your site name. Response comes from Cloudflare. Certificate looks fine. And it says it can not contact your server. So it’s a matter of Cloudflare->server problem.
How did you setup proxy on Cloudflare? Is it configured to hit Ghost directly on port 2368 or Nginx on 443? Are you allowing Cloudflare to access your server:port?

on cloudflare I set only an A name pointing to the vm ip address, and on the vm I allow https connection, but I don’t have any specific rule. ufw allow nginx full.

Thanks for your solutions. I also have the same case.