Nextcloud AIO behind Nginx Proxy Manager

Hello, I would like to install Nextcloud AIO behind an existing nginx proxy manager.
I am a bit confused about the installation guide. As a best practice it is recommended to run nginx proxy manager as an external network (see link ), to which the other containers connect to and you enter the container name as host in nginx proxy user interface .

This is my nginx proxy compose file:

version: '3.8'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
networks:
  default:
    external: true
    name: nginx-proxy

usually I just add

networks:
  default:
    external: true
    name: nginx-proxy

to the other services, enter the container name as host and then everything is working. Unfortunately I can not find the issue with my currenct nextcloud aio docker compose file:

services:
  nextcloud-aio-mastercontainer:
    image: nextcloud/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 # May be changed on macOS, Windows or docker rootless. See the applicable documentation. If adjusting, don't forget to also set 'WATCHTOWER_DOCKER_SOCKET_PATH'!
    ports:
      # - 80:80 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
      - 8080:8080
      # - 8443:8443 # Can be removed when running behind a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
    environment: # Is needed when using any of the options below
      - APACHE_PORT=11000 # Is needed when running behind a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else). See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
      # - APACHE_IP_BINDING=127.0.0.1 # Should be set when running behind a web server or reverse proxy (like Apache, Nginx, Cloudflare Tunnel and else) that is running on the same host. See https://github.com/nextcloud/all-in-one/blob/>
      - NEXTCLOUD_DATADIR=/data/nextcloud # Allows to set the host directory for Nextcloud's datadir. ⚠️⚠️⚠️ Warning: do not set or adjust this value after the initial Nextcloud installation is done! See https://github.com/nextcloud/all-in>

volumes: # If you want to store the data on a different drive, see https://github.com/nextcloud/all-in-one#how-to-store-the-filesinstallation-on-a-separate-drive
  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

networks:
  default:
    external: true
    name: nginx-proxy

When I enter the data to nginx proxy manager user interface:

I only get “502 Bad gateway”

What do I need to do, that this is working without using “network_mode: host” to block additional ports on the host machine?

Thank you for your support! I really trying already since hours.

Hi, can you follow all-in-one/reverse-proxy.md at main · nextcloud/all-in-one · GitHub?

Thank you szaimen, I have tested it already. But the debug section is related to use “host”. So it is not helping in this case.

Have you already tried pointing at host.docker.internal:$APACHE_PORT as suggested?

Thank you for your support. But it seems like nginx proxy manager / nginx does not resolve the hosts corretly with that:

See this issue