# 502 Gateway Error: Discourse Installation with SSL form Cloudflare

**URL:** <https://meta.discourse.org/t/502-gateway-error-discourse-installation-with-ssl-form-cloudflare/157986>\
**Category:** Self-hosting\
**Created:** [16 juli 2020 om 22:15 UTC](https://meta.discourse.org/t/502-gateway-error-discourse-installation-with-ssl-form-cloudflare/157986 "2020-07-16T22:15:47Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![AntiMetaman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/antimetaman/32/186978_2.png) [@AntiMetaman](https://meta.discourse.org/u/AntiMetaman)\
**Post date:** [16 juli 2020 om 22:15 UTC](https://meta.discourse.org/t/502-gateway-error-discourse-installation-with-ssl-form-cloudflare/157986/1 "2020-07-16T22:15:47Z")

</div>

Hi guys,

I’m installing the official Discourse for the first time. I followed the standard instructions: [discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) except I also followed these modifications to my port since port 80 is occupied: [Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247)

I changed the exposed ports to 3002:3000. My default directory for where I cloned the git and have all my discourse files is var/www/docker-sites/discourse instead of var/discourse. My app.yml is the same as the standalone.yml in the samples folder except for the change in ports and default directory.  
I am using cloudflare to generate my SSL certificate and key. The details of which are in my etc/nginx/nginx.conf.

I am not migrating any database. This is a fresh install with no users or posts. My VPS has 2 GB of RAM.

I get a 502 gateway error. I’ve tried refreshing. Yes, my DNS records are properly on cloudflare and it is being proxied. The domain is the same as the one in app.yml. I put all my SMTP email info as well in the app.yml correctly. I ran the `./launcher rebuild app` command with no errors. I’m on Ubuntu 20.04.

Any ideas of why I’m getting this 502 gateway error?

---

_[View the full topic](https://meta.discourse.org/t/502-gateway-error-discourse-installation-with-ssl-form-cloudflare/157986)._
