Nextcloud 502 "Bad Gateway" / letsencrypt/swag

Hi, I hope someone can help:
I run:

  • Raspi4
  • New install debian buster light
  • OpenMediaVault + Docker + Portrainer installed
  • Port 443 is open and forwarded to Raspi

I used the docker compose stack for nextcloud + mariadb + swag, see this website -> /general/swag#nextcloud-subdomain-reverse-proxy-example

My file:


---
version: "2.1"
services:
  nextcloud:
image: ghcr.io/linuxserver/nextcloud
container_name: nextcloud
environment:
  - PUID=998
  - PGID=100
  - TZ=Europe/Berlin
volumes:
  - /var/lib/appdata/nextcloud/config:/config
  - /var/lib/appdata/nextcloud/data:/data
depends_on:
  - mariadb
restart: unless-stopped
  mariadb:
image: ghcr.io/linuxserver/mariadb
container_name: mariadb
environment:
  - PUID=998
  - PGID=100
  - MYSQL_ROOT_PASSWORD=mariadbpassword
  - TZ=Europe/Berlin
  - MYSQL_DATABASE=nextcloud
  - MYSQL_USER=ncuser
  - MYSQL_PASSWORD=ncpassword
volumes:
  - /var/lib/appdata/mariadb:/config
restart: unless-stopped
  swag:
image: ghcr.io/linuxserver/swag
container_name: swag
cap_add:
  - NET_ADMIN
environment:
  - PUID=998
  - PGID=100
  - TZ=Europe/Berlin
  - URL=mydomain.duckdns
  - SUBDOMAINS=wildcard
  - VALIDATION=duckdns
  - DUCKDNSTOKEN=myToken
volumes:
  - /var/lib/appdata/swag:/config
ports:
  - 443:443
  - 82:80
restart: unless-stopped

  • I adapted the PUID/PGID to the OMV admin
  • I changed port 80 to 82, since OMV is using port 80

–> The containers are running

  • I renamed the nextcloud.subdomain.conf.sample --> nextcloud.subdomain.conf (and in there changed the proxy_max_tempfile_size to 1024m since rapsi doesn’t cope with 2048)
  • restarted all containers

–> swag log says: Certificate exists (did run before); parameters unchanged; starting nginx
–> nginx error.log says: [error] 462#462: 1 nextcloud could not be resolved (110: Operation timed out), client: my.external.ip.99, server: nextcloud., request: β€œGET / HTTP/2.0”, host: β€œnextcloud.mydomain.duckdns.org”
–> nextcoud container log says: nginx: [emerg] cannot load certificate β€œ/config/keys/cert.crt”: BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(’/config/keys/cert.crt’,β€˜r’) error:2006D080:BIO routines:BIO_new_file:no such file)

So somehow the cert.crt file is not placed there. A cert.key file is there, though.

Any ideas and regards!

See here: FAQ - LinuxServer.io

2 Likes

You are AMAZING! Thanks sooo much! Solving one week desperation with 2 words and a link!!

2 Likes

Thanks .!!! I got the same problem .