[SOLVED] Nexcloud not reachable - 502 Bad Gateway

  • Hi to all,


    Following the guide linked below, I setup my NextCloud with Swag as the subdomain https://nextcloud.mydns.it/

    [How-To] Nextcloud with Letsencrypt using OMV and docker-compose


    Unfortunately, I can't access because I obtain alway the "502 Bad Gateway" error.


    Here is my configuration, I hope someone can help me...

    • Docker for Nextcloud, MariaDB and Swag (reverse proxy)
    • DNS CloudFlare


    A) NextCloud (docker)


    B) Swag (docker)


    C) DNS (Cloudflare)

    TypeNameContentTTLProxy status
    Amydns.it123.456.789.012AutoDNS only
    CNAMEnextcloudmydns.itAutoDNS only




    D) NextCloud configuration file <config.php>


    E) NextCloud subdomain configuration <nextcloud.subdomain.conf>



    Really thank you all in advance.

  • Line 23 under swag is optional? I don't think that is the case. Regardless... if you've not moved OMV to another port, OMV is taking port 80, so you need to either forward OMV to another port, or forward swag to another port.

    Air Conditioners are a lot like PC's... They work great until you open Windows.


  • Your post suggests that you use different docker-compose.yml files for swag and Nextcloud. This won’t work because the guide relies on the fact that container in a joined docker-compose file will be added in a docker network, which is required for docker internal dns resolution.


    Does the swag container get the certs?


    Line 23 under swag is optional? I don't think that

    It’s only necessary to expose port 80 of the swag container if using validation=http

  • Your post suggests that you use different docker-compose.yml files for swag and Nextcloud. This won’t work because the guide relies on the fact that container in a joined docker-compose file will be added in a docker network, which is required for docker internal dns resolution.


    Does the swag container get the certs?


    It’s only necessary to expose port 80 of the swag container if using validation=http

    Hmm, did not know that.


    What he said above about the two compose/stack files makes sense. You could just deploy the first two, then add the swag container onto the end of the compose/stack, and redeploy

    Air Conditioners are a lot like PC's... They work great until you open Windows.


  • Following the guide linked below

    Would be easier if you would really follow the guide. That includes putting all container in one docker-compose file and not two as well as the ports mentioned by KM0201.


    If you setup the container separately, you must make sure they are on the same docker network, so that they can talk to each other.

  • Your post suggests that you use different docker-compose.yml files for swag and Nextcloud. This won’t work because the guide relies on the fact that container in a joined docker-compose file will be added in a docker network, which is required for docker internal dns resolution.

    Yeah, you're right.

    Moving swag inside the Nextcloud stack, finally I can reach it.

    Do I have to move also MariaDB inside it or can I keep it outside?


    Then... I used swag in a different stack because I'd like to enable more subdomains for other containers (eg. Heimdall).

    Do I have to move all of them inside the same compose file or not?

  • You can manually set their networks in Portainer, if you're using it.

    Air Conditioners are a lot like PC's... They work great until you open Windows.


  • mbinax

    Added the Label resolved
  • mbinax

    Changed the title of the thread from “Nexcloud not reachable - 502 Bad Gateway” to “[SOLVED] Nexcloud not reachable - 502 Bad Gateway”.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!