Docker installation does not work with Cloudflare proxy

I rigged up an Amazon EC2 instance to host Discourse and everything seems to be going well - until I have put all my information into the install script and it executes after which the Discourse docker image is supposed to be working on port 80.

That doesn’t happen.

I have no idea why. One thing that I have been able to diagnose is that if I stop the docker container, then when I restart it, if I go to the IP address of my ec2 instance, I get the default nginx server screen. But then in a few seconds, that stops as well.

I used the docker installation as recommended.

When I navigate to the domain name, nothing happens. When I navigate to the IP address nothing happens.

It is running on port 80.

When I stop the docker container and restart it, as mentioned above, I can get the default nginx “its working” webpage. Then it goes back to not working after a few seconds.

What is going on here? This is highly frustrating.

How do I look at the error logs for this?

What distro are you running? A standard Ubuntu server doesn’t come with nginx, so unless you installed it manually you should never see this page.

If you have nginx running in the host that will indeed interfere with the install and make it misbehave.

Hey Rafael, thanks for your response.

I think I may have changed my /etc/hosts to get around the real problem, actually, which was that the installer said port 443 and port 80 were not accessible using the hostname I am using.

I actually decided to delete the install and start from the beginning, and this is what’s happening again. So why don’t we forget everything I said above and start anew.

Why wouldn’t it be able to to access ports 443 & 80?

I have my EC2 security group configured to allow all incoming HTTP and HTTPS traffic, so I’m a little confused here.

The standard install does not use nginx installed on the system and if you have nginx installed on the host, Discourse will not have access to ports 08 and 443. By installing nginx on the system, you have prevented Discourse from working in its standard configuration.

This has nothing to do with Amazon. It’s just Linux system administration.

(It can be appropriate to have nginx installed on the system for Setting up offline page but that requires understanding how ports work under Linux. :slight_smile: So don’t start there if the current situation doesn’t make sense to you!)

1 Like

Like I said, scrap that.

I figured it out.

It turns out that you can not allow Cloudflare to proxy your discourse subdomain - you have to click the orange cloud on the subdomain A record to grey for DNS only – and then your discourse installation should have no problem accessing the appropriate ports.


1 Like