502 Bad Gateway from Nginx Proxy Manager when accessing Nextcloud AIO

Hi,

Same troubles for me.

Having nextcloud-aio and npm on same host, both with docker.

On NPM side => Error 502 Bad gateway accessing by nc.mydomaine.fr

On Nextcloud-AIO side => verifying domain => Error : Domain does not point to this server or the reverse proxy is not configured correctly.

Here is my nextcloud-AIO docker compose file :

services:
  nextcloud-aio-mastercontainer:
    image: ghcr.io/nextcloud-releases/all-in-one:latest
    init: true
    restart: always
    container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed as otherwise AIO will not work correctly
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config # This line is not allowed to be changed as otherwise the built-in backup solution will not work
      - /var/run/docker.sock:/var/run/docker.sock:ro
    network_mode: bridge
    ports:
      - 8080:8080 # This is the AIO interface, served via https and self-signed certificate. 
    environment:
       APACHE_PORT: 11000 # Is needed when running behind a reverse proxy
       APACHE_IP_BINDING: 127.0.0.1  # Should be set when running behind a reverse proxy running on the same host. 
       APACHE_ADDITIONAL_NETWORK: nginx-network # Needed when behind a reverse proxy running in a different docker network on same server.
       NEXTCLOUD_DATADIR: /mnt/ncdata # Allows to set the host directory for Nextcloud's datadir
       NEXTCLOUD_UPLOAD_LIMIT: 16G
       NEXTCLOUD_MAX_TIME: 3600
       NEXTCLOUD_MEMORY_LIMIT: 2000M

volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontainer # This line is not allowed to be changed as otherwise the built-in backup solution will not work

And here is my NPM docker compose file :

services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      # These ports are in format <host-port>:<container-port>
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '127.0.0.1:81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP
    environment:
      # Use nginx service under this account (not root) inside docker container 
      # Need to be 0 or ROOT for nextcloud-aio 
      PUID: 0
      PGID: 0
      # Postgres parameters:
      DB_POSTGRES_HOST: 'db'
      DB_POSTGRES_PORT: '5432'
      DB_POSTGRES_USER: 'nginx-pm'
      DB_POSTGRES_PASSWORD: 'xxxxxxxxxx'
      DB_POSTGRES_NAME: 'npm-db'
      DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db

  db:
    image: postgres:latest
    restart: always
    environment:
      POSTGRES_USER: 'nginx-pm'
      POSTGRES_PASSWORD: 'xxxxxxxxxxxxxxxx'
      POSTGRES_DB: 'npm-db'
    volumes:
      - ./postgres:/var/lib/postgresql/data

networks:
  default:
    external: true
    name: nginx-network
  nextcloud-aio:
    external: true

As you can see, I have followed instructions for having reverse proxy in an another docker container :

  1. On nextcloud side
APACHE_ADDITIONAL_NETWORK: nginx-network
  1. On NPM side
networks:
  default:
    external: true
    name: nginx-network
  nextcloud-aio:
    external: true

Proxy host on NPM is configured as expected I think :

So what’s the matter ? thanks for your help.

Regards