<p>I had the exact same issue. After investigating and looking at my nginx proxy <code>/etc/nginx/conf.d/default</code> I discovered that the nginx proxy was unable to connect to the container.</p>
<p>The solution was to add the nginx proxy container to the same docker network as the wikijs container.</p>

CC BY-SA 4.0
2022-03-16T22:49:00.090Z
2022-03-16T23:40:53.443Z
2022-03-16T23:40:53.443Z
nametable
<p>I am having difficulty getting <a href="https://js.wiki/" rel="nofollow noreferrer">Wiki.js</a> hosted on a server.</p>
<p>My current setup is using <code>docker-compose</code> utilising a reverse proxy with the eventual aim to host some services. I have successfully managed to host Portainer (using a guide). And I can host Wiki.js in its own docker container, but adding the service together is failing with a <code>502</code> error. Portainer is still working, however.</p>
<p>Here is the <code>docker-compose.yml</code> file:</p>
<pre class="lang-yml prettyprint-override"><code>version: '2'

services:

  proxy:
    image: jwilder/nginx-proxy
    container_name: proxy
    restart: unless-stopped
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: &quot;true&quot;
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - certs:/etc/nginx/certs:rw
      - vhost.d:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - ./uploadsize.conf:/etc/nginx/conf.d/uploadsize.conf:ro
    ports:
      - &quot;80:80&quot;
      - &quot;443:443&quot;
    networks:
      - &quot;default&quot;
      - &quot;proxy-tier&quot;

  proxy-letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: letsencrypt
    restart: unless-stopped
    environment:
      - NGINX_PROXY_CONTAINER=proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    volumes_from:
      - &quot;proxy&quot;
    depends_on:
      - &quot;proxy&quot;
    networks:
      - &quot;default&quot;
      - &quot;proxy-tier&quot;

  portainer:
    image: portainer/portainer
    container_name: portainer
    restart: always
    environment:
      - VIRTUAL_HOST=docker.example.com
      - LETSENCRYPT_HOST=docker.example.com
      - LETSENCRYPT_EMAIL=me@example.com
    volumes:
      - ./portainer/:/data
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - &quot;9000:9000&quot;
## Wiki.js specific container (db)
  db:
    image: postgres:11-alpine
    container_name: wiki
    environment:
      POSTGRES_DB: wiki
      POSTGRES_PASSWORD: wikijsrocks
      POSTGRES_USER: wikijs
    logging:
      driver: &quot;none&quot;
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data
## Wiki.js specific container (app)
  wiki:
    image: requarks/wiki:2
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
      VIRTUAL_HOST: wiki.example.ml
      LETSENCRYPT_HOST: wiki.example.ml
      LETSENCRYPT_EMAIL: me@example.com
    restart: always
    ports:
      - &quot;8010:3000&quot; 

volumes:
  certs:
  vhost.d:
  html:
  db-data:

networks:
  proxy-tier:
</code></pre>

<docker><nginx><tls>
Hosting Wiki.js using nginx-proxy
Matthew Ewan-Laws
# Hosting Wiki.js using nginx-proxy

(Asked by: username_0 on 2021-11-02)

I am having difficulty getting Wiki.js hosted on a server.
My current setup is using docker-compose utilising a reverse proxy with the eventual aim to host some services. I have successfully managed to host Portainer (using a guide). And I can host Wiki.js in its own docker container, but adding the service together is failing with a 502 error. Portainer is still working, however.
Here is the docker-compose.yml file:
version: '2'

services:

  proxy:
    image: jwilder/nginx-proxy
    container_name: proxy
    restart: unless-stopped
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - certs:/etc/nginx/certs:rw
      - vhost.d:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - ./uploadsize.conf:/etc/nginx/conf.d/uploadsize.conf:ro
    ports:
      - "80:80"
      - "443:443"
    networks:
      - "default"
      - "proxy-tier"

  proxy-letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: letsencrypt
    restart: unless-stopped
    environment:
      - NGINX_PROXY_CONTAINER=proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    volumes_from:
      - "proxy"
    depends_on:
      - "proxy"
    networks:
      - "default"
      - "proxy-tier"

  portainer:
    image: portainer/portainer
    container_name: portainer
    restart: always
    environment:
      - VIRTUAL_HOST=docker.example.com
      - LETSENCRYPT_HOST=docker.example.com
      - LETSENCRYPT_EMAIL=me@example.com
    volumes:
      - ./portainer/:/data
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "9000:9000"
## Wiki.js specific container (db)
  db:
    image: postgres:11-alpine
    container_name: wiki
    environment:
      POSTGRES_DB: wiki
      POSTGRES_PASSWORD: wikijsrocks
      POSTGRES_USER: wikijs
    logging:
      driver: "none"
    restart: unless-stopped
    volumes:
      - db-data:/var/lib/postgresql/data
## Wiki.js specific container (app)
  wiki:
    image: requarks/wiki:2
    depends_on:
      - db
    environment:
      DB_TYPE: postgres
      DB_HOST: db
      DB_PORT: 5432
      DB_USER: wikijs
      DB_PASS: wikijsrocks
      DB_NAME: wiki
      VIRTUAL_HOST: wiki.example.ml
      LETSENCRYPT_HOST: wiki.example.ml
      LETSENCRYPT_EMAIL: me@example.com
    restart: always
    ports:
      - "8010:3000" 

volumes:
  certs:
  vhost.d:
  html:
  db-data:

networks:
  proxy-tier:

**Tags:** docker, nginx, tls


---

## 1 answers

### Answer by username_1 on 2022-03-16. Score: 0

I had the exact same issue. After investigating and looking at my nginx proxy `/etc/nginx/conf.d/default` I discovered that the nginx proxy was unable to connect to the container.

The solution was to add the nginx proxy container to the same docker network as the wikijs container.


---

