Swag + nextcloud issue

Hello,

I am trying to configure swag and nextcloud to work on my Raspberry Pi 4 (Raspberry Pi OS 32-bit).
I am facing the following issue:

  • when I try to access nextcloud localy on host.ip:444 I land on the " Welcome to your SWAG instance" page
  • when I try to access nextcloud from the internet on nextcloud.xxx.duckdns.org I get a timeout
  • when I try to access nextcloud from the internet bypassing the reverse proxy on xxx.duckdns.org:49170 or host.ip:49170 I can reach the nextcloud login page but with the “Your connection is not private” warning

This is my docker-compose.yaml file:

---
version: "2.1"
services:
  nextcloud:
    image: ghcr.io/linuxserver/nextcloud
    container_name: nextcloud
    environment:
      - PUID=1001
      - PGID=100
      - TZ=Europe/MyCity
    volumes:
      - /my/nextcloud/config/location:/config
      - /my/data/location:/data
	ports:
	  - 49170:443
    restart: unless-stopped
  swag:
    image: ghcr.io/linuxserver/swag
    container_name: swag
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=1001
      - PGID=100
      - TZ=Europe/MyCity
      - URL=xxx.duckdns.org
      - SUBDOMAINS=wildcard
      - VALIDATION=duckdns
      - DUCKDNSTOKEN=my-token
      - CERTPROVIDER=zerossl
      - EMAIL=my.email@gmail.com
    volumes:
      - /my/swag/config:/config
    ports:
      - 444:443
      - 81:80
    restart: unless-stopped

I tried renaming swag’s config/nginx/proxy-confs/nextcloud.subdomain.conf.sample file both nextcloud.subdomain.conf and nextcloud.xxx.duckdns.org.conf. It didn’t work with either of the names. It’s contents are the following:

## 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 nextcloud.*;

    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 1024m;
    }
}

nextcloud’s config.php

	<?php
$CONFIG = array (
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'datadirectory' => '/data',
  'instanceid' => 'xxxxxxx',
  'trusted_proxies' => ['swag'],
  'trusted_domains' => 
    array (
      0 => 'host.ip:444',
      1 => 'nextcloud.xxx.duckdns.org',
   ),
  'overwrite.cli.url' => 'https://nextcloud.xxx.duckdns.org/',
  'overwritehost' => 'nextcloud.xxx.duckdns.org',
  'overwriteprotocol' => 'https',
);