Nextcloud with SWAG Reverse Proxy Error 502

Hi! I’m trying to get Nextcloud running with Postgres on a Docker container and using linuxserver/swag as a reverse proxy on a Raspberry Pi 4B 4GB. I was able to get all my other containers running with swag but Nextcloud is giving me a lot of troubles. I always get a 502 error when connecting, I don’t know why and I can’t figure it out. This is my docker-compose.yml:

version: "3.3"

services:
    nextcloud-db:
        image: postgres:latest
        restart: on-failure
        env_file:
            - postgres.env
        volumes:
            - /mnt/hdd/nextcloud-db:/var/lib/postgresql/data
        networks:
            - nextcloud
        container_name: nextcloud-db
    nextcloud:
        image: nextcloud:latest
        restart: on-failure
        depends_on:
            - nextcloud-db
        env_file:
            - nextcloud.env
        volumes:
            - /mnt/hdd/nextcloud:/var/www/html
        networks:
            - nextcloud
            - swag
        container_name: nextcloud

networks:
    nextcloud:
        external: true
    swag:
        external: true

This is my proxy config:

## Version 2021/05/18
# make sure that your dns has a cname set for nextcloud
# assuming this container is called "swag", edit your nextcloud container's config
# located at /config/www/nextcloud/config/config.php and add the following lines before the ");":
#  'trusted_proxies' => ['swag'],
#  'overwrite.cli.url' => 'https://nextcloud.your-domain.com/',
#  'overwritehost' => 'nextcloud.your-domain.com',
#  'overwriteprotocol' => 'https',
#
# Also don't forget to add your domain name to the trusted domains array. It should look somewhat like this:
#  array (
#    0 => '192.168.0.1:444', # This line may look different on your setup, don't modify it.
#    1 => 'nextcloud.your-domain.com',
#  ),

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name nc.fyulita.com;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app nextcloud;
        set $upstream_port 443;
        set $upstream_proto https;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

        # proxy_max_temp_file_size 2048m;
        # proxy_max_temp_file_size 1024m;
    }
}

The only thing I changed from the default config for Nextcloud is that I commented out the proxy_max_temp_file_size 2048m since it gave me an error. The instructions on the top of the file I couldn’t really follow since the file config.php doesn’t exist :frowning:

Any help is deeply appreciated :slight_smile:

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