All in one returns bad gateway

I am running Nextcloud All in One behind an existing reverse proxy, OpenResty. Specifically I am using 1Panel to manage dockers.

compose.yml

# ignored options for 'all-in-one'
# --sig-proxy=false
# named volume 'nextcloud_aio_mastercontainer' is marked as "external" (used by service 'all-in-one'), so either remove "external" from volume definition or it needs to be created using: docker volume create nextcloud_aio_mastercontainer
name: meadowfield_cloud
services:
    all-in-one:
        init: true
        container_name: nextcloud-aio-mastercontainer
        restart: always
        ports:
            - 8080:8080
        environment:
            - APACHE_PORT=11000
            - APACHE_IP_BINDING=0.0.0.0
            - APACHE_ADDITIONAL_NETWORK=
            - SKIP_DOMAIN_VALIDATION=true
            - NEXTCLOUD_DATADIR=/media/cloud_drive/meadowfield_cloud
        volumes:
            - nextcloud_aio_mastercontainer:/mnt/docker-aio-config
            - /var/run/docker.sock:/var/run/docker.sock:ro
        image: ghcr.io/nextcloud-releases/all-in-one:latest
volumes:
    nextcloud_aio_mastercontainer:
        external: true
        name: nextcloud_aio_mastercontainer

reverse proxy configuration:

server {
    listen 80 ; 
    listen 443 ssl http2 ; 
    server_name nextcloud.sampledomain.com; 
    index index.php index.html index.htm default.php default.htm default.html; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Host $server_name; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection $http_connection; 
    access_log /www/sites/nextcloud.sampledomain.com/log/access.log main; 
    error_log /www/sites/nextcloud.sampledomain.com/log/error.log; 
    location ^~ /.well-known/acme-challenge {
        allow all; 
        root /usr/share/nginx/html; 
    }
    include /www/sites/nextcloud.sampledomain.com/proxy/*.conf; 
    if ($scheme = http) {
        return 301 https://$host$request_uri; 
    }
    ssl_certificate /www/sites/nextcloud.sampledomain.com/ssl/fullchain.pem; 
    ssl_certificate_key /www/sites/nextcloud.sampledomain.com/ssl/privkey.pem; 
    ssl_protocols TLSv1.3 TLSv1.2 TLSv1.1 TLSv1; 
    ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:!aNULL:!eNULL:!EXPORT:!DSS:!DES:!RC4:!3DES:!MD5:!PSK:!KRB5:!SRP:!CAMELLIA:!SEED; 
    ssl_prefer_server_ciphers on; 
    ssl_session_cache shared:SSL:10m; 
    ssl_session_timeout 10m; 
    error_page 497 https://$host$request_uri; 
    proxy_set_header X-Forwarded-Proto https; 
    add_header Strict-Transport-Security "max-age=31536000"; 
}

error.log:

2025/09/14 14:30:25 [error] 1152#1152: *5344 connect() failed (111: Connection refused) while connecting to upstream, client: 172.70.126.42, server: nextcloud.sampledomain.com, request: "GET / HTTP/2.0", upstream: "http://172.27.0.2:11000/", host: "nextcloud.sampledomain.com"
2025/09/14 14:30:25 [error] 1152#1152: *5346 connect() failed (111: Connection refused) while connecting to upstream, client: 172.71.255.131, server: nextcloud.sampledomain.com, request: "GET /favicon.ico HTTP/2.0", upstream: "http://172.27.0.2:11000/favicon.ico", host: "nextcloud.sampledomain.com", referrer: "https://nextcloud.sampledomain.com/"

please review if the request is going to the right container (use docker inspect <container> and docker network inspect <network name> to review current IPs)

you didn’t set APACHE_ADDITIONAL_NETWORK so likely your apache container only attached to AiOs internal network.

AiO reverse proxy docs

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.