Nextcloud, swag and local lan access problem

Hi, there.

I’m a newbie who recently installed swag plus duckdns, nextcloud, radarr, sonarr, airsonic, etc. on my Pi4 4Gb with Raspbian.

I can access all the apps both from within my local network and from outside with (it’s true that from lan it’s a bit laggy but I access).

With the nextcloud container I can only access from outside the network and from the lan it is impossible.

This is my docker-compose, mariadb, nextcloud and swag part:

image: linuxserver/duckdns
container_name: duckdns
  - PUID=${PUID}
  - PGID=${PGID}
  - TZ=${TZ}
  - $HOME/docker/duckdns/config:/config
restart: unless-stopped

image: linuxserver/swag:1.8.0-ls15
container_name: swag
  - PUID=${PUID}
  - PGID=${PGID}
  - TZ=${TZ}
  - SUBDOMAINS=wildcard
  - VALIDATION=duckdns
  - DHLEVEL=2048
  - $HOME/docker/letsencrypt:/config
  - 1443:443
  - 180:80
restart: unless-stopped
image: linuxserver/mariadb
container_name: mariadb
  - PUID=${PUID}
  - PGID=${PGID}
  - TZ=${TZ}
  - $HOME/docker/mariadb/:/config
  - $HOME/docker/mariadb/conf.d:/etc/mysql/conf.d
  - 3306:3306
restart: unless-stopped

image: linuxserver/nextcloud
container_name: nube
  - PUID=${PUID}
  - PGID=${PGID}
  - TZ=${TZ}
  - $HOME/docker/nextcloud/appdata:/config
  - $HOME/docker/nextcloud/data:/data
  - 2443:443
  - 280:80
  - mariadb:mariadb
  - mariadb
restart: unless-stopped

My nextcloud.subdomain.conf


$CONFIG = array (
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘datadirectory’ => ‘/data’,
‘instanceid’ => ‘occh9faapt7b’,
‘passwordsalt’ => ‘vGQdjBYjQBo1tCbS1unyvW/Rz02EC2’,
‘secret’ => ‘SI0VMoL7tVJwfKdZlfxLOhfc2zqruO6uvvql2jJ/TAr4k7C9’,
‘trusted_domains’ =>
array (
0 => ‘’,
1 => ‘xxxx.example.duckdns.’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘’,
‘dbname’ => ‘nube’,
‘dbhost’ => ‘mariadb:3306’,
‘dbport’ => ‘’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘javier’,
‘dbpassword’ => ‘1234567890’,
‘trusted_proxies’ => [‘swag’],
‘overwrite.cli.url’ => ‘s://xxxx.example.duckdns./’,
‘overwritehost’ => ‘xxxx.example.duckdns.’,
‘overwriteprotocol’ => ‘https’,
‘installed’ => true,

I’ve spent the weekend reading and trying different configurations that I have found and I have not found the solution.

Anyone have any ideas how I can fix the problem?

Thanks in advance.

P.D.: I had to remove the example.duckdns because the system limit of 2 links.

overwrite.cli.url looks wrong and is 0 in your trusted domains array what was originally there, because it looks like it was changed?

also, you’re definitely going to have weird behavior with 1443 as the exposed port on swag from an internal perspective, so you’ll have to rely on hairpin nat.

Thank you for your prompt answer.

The really overwrite.cli.url’ => ‘s://xxxx.example.duckdns./’ is ‘’ but because a limitation in the maximum links I can write in a post as new user (2), I had to change them.

I changed the port to 1443 for being able to use pihole (I read it doesn’t work well without this port).

I will try to stop pihole and launch swag in ports 80 and 443.

I will keep you informed.

ahh makes sense, yah i hate that new users are link limited.

i would suggest remapping the 80/443 on your pihole and then using swag to reverse proxy to your pihole (pihole.subdomain.conf.sample, make sure you change the port to match)

that way, internally and externally, you can just use the name without ports being required.

Additionally, if you create dns records for everything in your pihole, probably in lan.list, then when you do an internal lookup of you’ll get the LAN ip of your docker host and hit swag directly without hairpin to your router. this will make things much quicker

once you move pihole though, try accessing nextcloud again and i think it’ll work, though proper hairpin nat should work fine as well, though with some added delay.

I have tried, changing the port on the router and in swag from 143 and 180 to 443 and 80, and stopping pihole. There is not much improvement.

I can access via Firefox but very slow. Nothing to do with the access I have to sonarr, for example.

Regarding moving pihole and modifying the local.list file, I have several questions:

Thanks for your help.


Changed the DNS of the router to the raspberry IP and added my xxxx.example.duckdns.or to “Local DNS records” pointing to the raspberry IP, and nextcloud begun to work like a charm.

Thank you @driz for your guidance.

1 Like

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