502 Bad Gateway on subdomain server


I have a main server that points to threepixelslab.gr using cloudflare cdn; let’s call it Server A.
I opened a second server that I want to point to aggelies.threepixelslab.gr; let’s call it Server B

I have letsencrypt running on both servers. Both servers are running the latest Ubuntu and nginx versions.

When I finished my setup on server B I got a 502 bad gateway error. I suppose I have done something wrong with my A and CNAME records. I haven’t done that kind of complex subdomain on different server again so please bare with me. Below follows a screenshot of my records in CF:

I appreciate your help.

When I go to the aggelies subdomain, the server sends me content:
content-type : application/octet-stream

So it’s not a 502, but it’s probably not what you want, as my browser thinks I’m trying to download something.

Also, you can’t proxy www for a subdomain because the Cloudflare certificate only covers first level subdomains. You’d need the $10/month cert with custom hostnames for that. Fortunately, it doesn’t look like you mean to use www for that subdomain…so you’ll probably be better off deleting that www.aggelies entry.

There was some lines missing in my server block I fixed that.

Deleted the www.aggelies record. But what should I look at. What’s my problem? Is it the records or my server setup?

Currently it loads. So I guess you fixed it, right?

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.