# Discourse with jwilder/nginx-proxy howtos?

**URL:** https://meta.discourse.org/t/discourse-with-jwilder-nginx-proxy-howtos/94604
**Category:** Self-hosting
**Created:** [13 augustus 2018 om 13:49 UTC](https://meta.discourse.org/t/discourse-with-jwilder-nginx-proxy-howtos/94604 "2018-08-13T13:49:55Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![vitorl](https://avatars.discourse-cdn.com/v4/letter/v/57b2e6/32.png) [@vitorl](https://meta.discourse.org/u/vitorl)
#### Post date: [15 november 2018 om 09:12 UTC](https://meta.discourse.org/t/discourse-with-jwilder-nginx-proxy-howtos/94604/6 "2018-11-15T09:12:13Z")

</div>

I use jwilder/nginx-proxy with discourse just fine.

What I did was to add the following stuff to my app.yml file:

```plaintext
VIRTUAL_HOST: domain.com
VIRTUAL_PORT: 80
LETSENCRYPT_HOST: domain.com
LETSENCRYPT_EMAIL: some@email.com

```

My ports are like this, but I don’t remember anymore why… I think it avoid discourse complaining about host 80 port is being used :

```plaintext
expose:
  - "127.0.0.1:3040:80"`

```

Make sure your container is connected to the nginx network with:

```plaintext
docker_args:
  - "--network=name-of-your-network"

```

To fix discourse not getting the real IP from the host nginx, add this to your `app.yml`:

```
run:
  - replace:
      filename: /etc/nginx/conf.d/discourse.conf
      from: "types {"
      to: |
        set_real_ip_from 172.18.0.0/24;
        real_ip_header X-Forwarded-For;
        real_ip_recursive on;
        types {

```

Make sure the network there matches the subnet of your nginx docker network. You can check with `docker inspect nginx-proxy` and the ip in the command above will always be your gateway but replace last digit for 0.

So for me my nginx-proxy gateway is `172.18.0.1` so that’s why I have it as `172.18.0.0`

---

_[View the full topic](https://meta.discourse.org/t/discourse-with-jwilder-nginx-proxy-howtos/94604)._
