skip to Main Content

I’ve a Raspberry at home and I try to run the Following setup :

  • Nginx Proxy Manager (jc21/nginx-proxy-manager) as reverse proxy to acces
  • Portainer (portainer/portainer-ce)
  • WordPress (docker official image)
  • Nextcloud (docker official image)

It’s working really well for portainer but for the other two I get a Bad Gateway Error (https and also http).

I’ve found some solutions on the web but none of them work for me + all of them was "do this, this and this" solutions. I want a real understanding of what going on and how to fix this.

I link the docker-compose files that I use and screens for the conf in Nginx Proxy Manager.

Thanks for your help !

Nginx Proxy Manager

    version: "3.8"
    networks:
        dockerpi:
        external: true
    services:
    npm-app:
        image: "jc21/nginx-proxy-manager:latest"
        ports:
        - "80:80"
        - "81:81"
        - "443:443"
        environment:
        DB_MYSQL_HOST: "npm-db"
        DB_MYSQL_PORT: 3306
        DB_MYSQL_USER: "npm"
        DB_MYSQL_PASSWORD: "npm"
        DB_MYSQL_NAME: "npm"
        volumes:
        - ./data:/data
        - ./letsencrypt:/etc/letsencrypt
        networks:
        - dockerpi
    npm-db:
        image: "jc21/mariadb-aria:latest"
        environment:
        MYSQL_ROOT_PASSWORD: "npm"
        MYSQL_DATABASE: "npm"
        MYSQL_USER: "npm"
        MYSQL_PASSWORD: "npm"
        volumes:
        - ./data/mysql:/var/lib/mysql
        networks:
        - dockerpi

Portainer

    version: "3.8"
        networks:
            dockerpi:
            external: true
        services:
        portainer:
            image: portainer/portainer
            privileged: true
            ports:
            - "8000:8000"
            - "9000:9000"
            volumes:
            - "./data:/data"
            - "/var/run/docker.sock:/var/run/docker.sock"
            restart: always
            networks:
            - dockerpi

Nextcloud

    version: "3.8"
    networks:
        dockerpi:
        external: true
    services:
    nextcloud-db:
        image: mariadb
        restart: always
        command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
        volumes:
        - ./db:/var/lib/mysql
        environment:
        - MYSQL_ROOT_PASSWORD=nexcloud
        - MYSQL_PASSWORD=nexcloud
        - MYSQL_DATABASE=nextcloud
        - MYSQL_USER=nextcloud
        networks:
        - dockerpi
    nextcloud-app:
        image: nextcloud
        restart: always
        ports:
        - 8010:80
        - 9010:9000
        links:
        - nextcloud-db
        volumes:
        - ./nextcloud:/var/www/html
        environment:
        - MYSQL_PASSWORD=nextcloud
        - MYSQL_DATABASE=nextcloud
        - MYSQL_USER=nextcloud
        - MYSQL_HOST=nextcloud-db
        networks:
        - dockerpi

WordPress

    version: "3.8"
    networks:
        dockerpi:
        external: true
    services:
    wp-test:
        image: wordpress
        restart: always
        ports:
        - 8020:80
        environment:
        WORDPRESS_DB_HOST: wp-test-db
        WORDPRESS_DB_USER: exampleuser
        WORDPRESS_DB_PASSWORD: examplepass
        WORDPRESS_DB_NAME: exampledb
        volumes:
        - ./wordpress:/var/www/html
        networks:
        - dockerpi
    wp-test-db:
        image: mariadb
        restart: always
        environment:
        MYSQL_DATABASE: exampledb
        MYSQL_USER: exampleuser
        MYSQL_PASSWORD: examplepass
        MYSQL_RANDOM_ROOT_PASSWORD: "1"
        volumes:
        - ./db:/var/lib/mysql
        networks:
        - dockerpi

ps: I don’t post the screens because it’s seem I can not post images now.

2

Answers


  1. If this is about the bad gateway error of admin page of nginx proxy manager, I did this and it fixed for me, I hope it fix your problem too:

    1. Change your docker-compose.yml file to this:
    version: '2'
    services:
      app:
        image: 'jc21/nginx-proxy-manager:latest'
        restart: unless-stopped
        ports:
          - '80:80'
          - '81:81'
          - '443:443'
        environment:
          DB_MYSQL_HOST: "db"
          DB_MYSQL_PORT: 3306
          DB_MYSQL_USER: "npm"
          DB_MYSQL_PASSWORD: "npm"
          DB_MYSQL_NAME: "npm"
        volumes:
          - ./data:/data
          - ./letsencrypt:/etc/letsencrypt
      db:
        image: 'jc21/mariadb-aria:latest'
        restart: unless-stopped
        environment:
          MYSQL_ROOT_PASSWORD: 'npm'
          MYSQL_DATABASE: 'npm'
          MYSQL_USER: 'npm'
          MYSQL_PASSWORD: 'npm'
        volumes:
          - ./data/mysql:/var/lib/mysql
    
    

    I changed it to version 2 instead of 3!

    1. Run these command:

    sudo docker-compose down

    and then

    sudo docker-compose up -d

    Login or Signup to reply.
  2. I was also facing the same issue. Turns out you need to input the container port in ‘port’ field of nginx proxy manager. For example for wordpress you need to enter ‘wordpress’ in ‘forward/ip’ field & ’80’ in port for it to work.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search