Blog.com works but www.blog.com doesn't?

So it’s my first time deploying any Ghostblog and I chose to use Google Compute Engine to do so. I’ve managed to figure it out quite a bit but I stumbled upon something strange that I’m not sure how to approach.

When setting up Ghost via ghost setup I go through a series of questions as described here. When asked for my blog’s domain, I enter https://farodefe.org which is what the tutorial indicates. During setup, Let’s Encrypt is able to grant me an SSL certificate and everything. The setup ends successfully and I’m able to go enter https://farodefe.org in any browser and see the website. Nevertheless, when I enter https://www.farodefe.org (in any browser) I only see a 502 Bad Gateway screen. The funny thing is that if I go through the setup again and I enter https://www.farodefe.org instead, then https://www.farodefe.org works but https://farodefe.org gives me a 502 Bad Gateway.

I’m not sure where the problem may rely. Evidently, it has to do something that happens during Ghost setup, but I’m not sure if it is a Nginx issue, or a Let’s Encrypt issue or a Ghost issue. I don’t think it is a DNS problem since it was setup correctly about a day ago and just to be sure I dig traced both the A and the CNAME register.

Any clues as to what could it be? Any insights into how to troubleshoot this phenomenon? Any Ghost/GoogleComputeEngine experts out there that could lend me a hand? Thanks in advance from a 17 year old guy who’s playing to be a serious developer!

Ghost only supports a single domain. So, you can’t have both www and your root domain set up at the same time. Instead, you have to redirect one of your domains.

See this part of the Ghost docs for more information:

You can also search the Forum for this issue to see how others have solved the problem!