Discourse with Docker on port 80

Discourse can cause you trouble if you have it running(listening) on a non-standard port inside the Docker instance. (the feed, google auth return url have the port and host info in them) (assuming you would like to serve requests from a standard http(s) port).

To make it work smoothly, I had to make it listen on standard port (80 in my case).
This is what I ended up doing:

Nginx(hostip:80) -> Nginx(dockerinsideip:80)

This method also extends to having multiple docker instance for different sites.
This is my nginx config on the host:

server {
    #where discourse sits
    server_name forum.mydomain.com;
    location / {
        #this is also important for discourse to work as expected
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        #my docker instances internal ip
        proxy_pass http://172.17.0.2;
    }
}

And, I removed http port mappings on my app.yml file.

WordPress + Nginx + Permalinks Rewrite rules

The following works for me:

  location /blog/ {
          index  index.php;
          # WordPress pretty URLs: (as per dominiek.com)
          if (-f $request_filename) {
                  break;
          }
          if (-d $request_filename) {
                  break;
          }
          rewrite ^/blog/(.+)$ /blog/index.php?q=$1 last;
 
          # Enable nice permalinks for WordPress: (as per Yawn.it)
          error_page  404  = /blog/index.php?q=$uri;
  }

I have my blog here: http://www.trk7.com/blog/
and my permalink structure is: /%postname%/