# Discourse not working through separate nginx docker

**URL:** https://meta.discourse.org/t/discourse-not-working-through-separate-nginx-docker/72071
**Category:** Self-hosting
**Created:** [October 14, 2017, 1:22pm UTC](https://meta.discourse.org/t/discourse-not-working-through-separate-nginx-docker/72071 "2017-10-14T13:22:41Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Rourke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rourke/32/120618_2.png) [@Rourke](https://meta.discourse.org/u/Rourke)
#### Post date: [October 14, 2017, 1:22pm UTC](https://meta.discourse.org/t/discourse-not-working-through-separate-nginx-docker/72071/1 "2017-10-14T13:22:41Z")

</div>

I’m trying to install discourse on my server with Ubuntu Server 16.04, where I’m already running a docker compose file with nginx. All containers in my docker file are on a separate network. I followed [this guide](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247) mostly. I succesfully rebuild the app and setup nginx with the following setup:

```
server {
    listen 80; listen [::]:80;
    server_name talk.webserver.nl;

    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name talk.webserver.nl;

    ssl on;
	include /etc/nginx/confs/nginx-ssl.conf;
	ssl_session_tickets off;

    location / {
        proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
        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;
    }
}

```

With this I cannot access `talk.webserver.nl`. I noticed it’s trying to call `/var/discourse/shared/standalone/nginx.http.sock` so I decided to add that to my nginx volumes. That didn’t work either, so it’s probably not necessary to have this in my volumes at all? I have no idea how the `unix` reference works and I can’t find anything on it.

When I shell access nginx I can ping to all my other containers but I’m not able to ping to the discourse container. Not sure if that has anything to do with it. What can I do to debug this?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [October 15, 2017, 4:01am UTC](https://meta.discourse.org/t/discourse-not-working-through-separate-nginx-docker/72071/2 "2017-10-15T04:01:20Z")

</div>

~~The way the volumes work is that `HOST /var/discourse/shared/NAME` is mapped to `CONTAINER /shared`. They’re already set up in the default app.yml.~~

The Discourse container `/shared` is mapped to the **host** `/var/discourse/shared/NAME`. You’ll need to make a new volume for your nginx container, maybe call it `/discourse_shared`, mapping to the same location.

Then your directive becomes:

```
proxy_pass http://unix:/discourse_shared/nginx.http.sock:;

```

> **[Unix domain socket](https://en.wikipedia.org/wiki/Unix_domain_socket)**
>
> A Unix domain socket (UDS), also called a local socket or inter-process communication (IPC) socket, is a communication endpoint used for data exchange between processes running on the same Unix or Unix-like operating system.
> The term Unix domain socket refers to the domain argument value AF\_UNIX passed to the system call that creates the socket. The same communication domain can also be selected with AF\_LOCAL.
> Valid type argument values for a UDS are:
> The UDS facility is a standard component o...

---

<div class="post-metadata">

### Author: ![Rourke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rourke/32/120618_2.png) [@Rourke](https://meta.discourse.org/u/Rourke)
#### Post date: [October 15, 2017, 2:42pm UTC](https://meta.discourse.org/t/discourse-not-working-through-separate-nginx-docker/72071/3 "2017-10-15T14:42:14Z")

</div>

I don’t quite understand how I would manage to do this. My `/shared` folder only contains the folder `standalone`.

The nginx part of my docker compose file looks like this:

```
  nginx:
    image: sickp/alpine-nginx:1.13.0-r1
    container_name: nginx
    ports:
      - "443:443"
      - "80:80"
    networks:
      - plexnet
    environment:
      - PUID=1000
      - PGID=1000
    volumes:
      - ${CONFIG_FOLDER}/nginx/nginx.conf:/etc/nginx/nginx.conf
      - ${CONFIG_FOLDER}/nginx/www:/etc/nginx/www
      # Configs
      - ${CONFIG_FOLDER}/nginx/confs:/etc/nginx/confs:ro
      # SSL
      - ${CONFIG_FOLDER}/nginx/dhparam.pem:/etc/nginx/dhparam.pem:ro
      - /etc/letsencrypt:/etc/letsencrypt:ro
      # Discourse websocket
      - /var/discourse/:/var/discourse/

```

With this `/var/discourse/` becomes fully accessible in my nginx container through `/var/discourse/shared/standalone/nginx.http.sock`. Isn’t this what you mean?

---

<div class="post-metadata">

### Author: ![Rourke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rourke/32/120618_2.png) [@Rourke](https://meta.discourse.org/u/Rourke)
#### Post date: [October 17, 2017, 10:25pm UTC](https://meta.discourse.org/t/discourse-not-working-through-separate-nginx-docker/72071/4 "2017-10-17T22:25:16Z")

</div>

I found the solution. I had to add the following to the `.yml` file:

```
docker_args: "--network apps_plexnet"

networks:
  apps_plexnet:
    external: true

```

After that I rebuilt it. Now they can see eachother and it all works.
