Error 502 on Docker AIO setup

Hello, I’m newly Deploying a Nextcloud AIO v3.1.0 AIO container. I’ve used plain nextcloud and had great results, but I was recommended to use the AIO. all my stuff is running on the same docker host

My current config is the following:
domain: cloud2.mydomain.com
Proxymanager: Nginx proxy manager
Host: Ubuntu 20.04

YAML:
nextcloud2:
image: nextcloud/all-in-one:latest
restart: always
container_name: nextcloud-aio-mastercontainer
volumes:
- nextcloud_aio_mastercontainer:/mnt/docker-aio-config
- /var/run/docker.sock:/var/run/docker.sock:ro
ports:
- 8080:8080
environment:
- APACHE_PORT=11000
- APACHE_IP_BINDING=127.0.0.1
- NEXTCLOUD_DATADIR=/docker/nextcloud2
- SKIP_DOMAIN_VALIDATION=true

I have added the domain in NGNIX proxy manager as “http://localhost:11000/” as per the docs, I’m able to access the initial config page at “http://ipofhost:8080/” and it shows that all the containers are started.

when i try to access the URL I get an error 502 bad gateway openresty and I’m not finding any errors in the logs that would indicate an issue

any insight would be greatly appreciated.

Hi, can you share your nginx proxy manager docker-compose file?

Absolutely, here you are, i have multiple sub domains on this that work without issue.

nginx-proxy-manager:
container_name: nginx-proxy-manager
image: ‘jc21/nginx-proxy-manager:latest’
restart: always
ports:
- ‘80:80’
- ‘81:81’
- ‘443:443’
volumes:
- /docker/nginxproxy/data:/data
- /docker/nginxproxy/letsencrypt:/etc/letsencrypt

Please add network_mode: "host" to your nginx proxy manager docker-compose which should make it work.

Right you are, i didnt add that as it would no longer allow me to use docker network.

thank you for solving this.

Hello - quick follow-up/clarification to this.

I am having what looks like the same issue, but in order to set network_mode: “host” in my docker-compose file, i would lose the possibility to change ports on other services in the same file? I have multiple web-based services all trying to fight for 8080, so I have to separate them. Any other ideas that might help me setting network_mode: “host” to get nextcloud and still be able to change ports? Forgive me if I have misunderstood - i am no sysadmin :slight_smile:

Thank you!

In that case you need to use -e APACHE_IP_BINDING=0.0.0.0 and in npm instead of localhost the local ip-address of the server that is running docker.

1 Like

Perfect! Thank you!

I got similar issues which is more complicated I think than asked befoer here. OS is utuntu server. This is my docker compose file;

version: "3.8"

services:
  nginx_proxy_manager:
    image: jc21/nginx-proxy-manager:latest
    restart: unless-stopped
    container_name: nginx-proxy-manager
    network_mode: host
    environment:
      - DISABLE_IPV6=true                                                                                                                                                                                                                     
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

  nextcloud:
    image: nextcloud/all-in-one:latest
    restart: unless-stopped
    container_name: nextcloud-aio-mastercontainer
    depends_on:
      - nginx_proxy_manager
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config
      - /var/run/docker.sock:/var/run/docker.sock:ro
    ports:
      - 8080:8080
    environment:
      - APACHE_PORT=11000

volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontainer

in my NPM setting I set:
Scheme: https
Forward Hostname / IP*: localhost
Forward Port *: 11000
I got " 502 Bad Gateway"
but if I set forward Port to 8080, I can access AIO setting interface.

Hi, see all-in-one/reverse-proxy.md at main · nextcloud/all-in-one · GitHub

Hi,
I read all the doc, i made all the think which is very helpfull for me, but I have the same error 502.
NPM is on network_mode: host
Like @Bing_H if I forward the port 8080 and I put scheme https and the port 8080 in NPM, that’s working.
Can somenone help me to do the right things ?
Thanks in adavance.
Best regards

Hi @antho_fo I would recommend to follow all-in-one/reverse-proxy.md at main · nextcloud/all-in-one · GitHub step-for-step.

Thanks for your fast reply.
Maybe it’s because I run portainer. I can’t find a configuration with portainer nginx proxy manager and nextcloud AIO. I will try and come back :wink: