Configure Discourse - Environment AWS Linux 2 AMI and Apache2 (httpd)

@pfaffman@Matthew_Lucas is already using the socketed template, though…

I’m definitely using localhost for my external proxy, and that should work with the expose setting. I wouldn’t expect it to need to use the docker IP. And I wouldn’t expect this to fail only with Apache in front of the docker container for that reason.

You might need header configuration — see Add an offline page to display when Discourse is rebuilding or starting up - #2 by codinghorror

I have been doing my best to forget Apache configuration, but this section of the nginx configuration is something you would want to figure out how to replicate with Apache, I think.

    proxy_set_header Host $http_host;
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Real-IP $remote_addr;

In particular, I don’t think it works right without the Host header.

Since you aren’t doing HTTPS, you should be able to use tcpdump to capture packet traces to see exactly what is going wrong.

However why put Apache in there at all? It’s just an extra hoop. If I were trying something like this, I’d be setting the Amazon load balancer to talk directly to port 8000 on the EC2 instance. I assume that you are terminating HTTPS on the ELB anyway. I suspect that their load balancer knows the normal headers to add without you needing to specify them, but if not obviously go ahead and set them. Just make sure that the port is accessible via the firewall.

I doubt I have much more of value to contribute here, but hopefully some of it helps you with your configuration. Best of luck.

1 Like