Nextcloud fpm docker example not working, where did I do wrong?

I’m new to nginx and I’m trying to understand how nginx works with nextcloud fpm. I tried to use the compose example from nextcloud github, but not sure why I keep getting “503 Service Temporarily Unavailable” from nginx when I type in my local IP (192.168.1.156). If I try my duckdns address I would get “This site cannot be reached”. I can see they are running just fine using portainer.

Could someone tell me where I did wrong?
Here is my db.env before running the compose file:

MYSQL_PASSWORD=mypassword
MYSQL_DATABASE=nextcloud
MYSQL_USER=nextcloud

docker compose file:

version: '3'

services:
  portainer-ce:
    container_name: portainer-ce
    image: portainer/portainer-ce
    restart: unless-stopped
    ports:
    - "8000:8000"
    - "9000:9000"
    # HTTPS
    - "9443:9443"
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - ./volumes/portainer-ce/data:/data

  db:
    image: mariadb:10.6
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    restart: always
    volumes:
      - /media/onetouch5t/pi4/data/nextcloud_test/db:/var/lib/mysql:Z
    environment:
      - MYSQL_ROOT_PASSWORD=mypassword
      - MARIADB_AUTO_UPGRADE=1
      - MARIADB_DISABLE_UPGRADE_BACKUP=1
    env_file:
      - db.env

  redis:
    image: redis:alpine
    restart: always
  app:
    image: nextcloud:fpm-alpine
    restart: always
    volumes:
      - /media/onetouch5t/pi4/data/nextcloud_test/nextcloud:/var/www/html:z
    environment:
      - MYSQL_HOST=db
      - REDIS_HOST=redis
    env_file:
      - db.env
    depends_on:
      - db
      - redis

  web:
    build: ./web
    restart: always
    volumes:
      - /media/onetouch5t/pi4/data/nextcloud_test/nextcloud:/var/www/html:z,ro
    environment:
      - VIRTUAL_HOST=mydomain.duckdns.org
      - LETSENCRYPT_HOST=mydomain.duckdns.org
      - LETSENCRYPT_EMAIL=gmailForNextCloudExample@gmail.com
    depends_on:
      - app
    networks:
      - proxy-tier
      - default

  cron:
    image: nextcloud:fpm-alpine
    restart: always
    volumes:
      - /media/onetouch5t/pi4/data/nextcloud_test/nextcloud:/var/www/html:z
    entrypoint: /cron.sh
    depends_on:
      - db
      - redis

  proxy:
    build: ./proxy
    restart: always
    ports:
      - 80:80
      - 443:443
    labels:
      com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
    volumes:
      - /media/onetouch5t/pi4/data/nextcloud_test/certs:/etc/nginx/certs:z,ro
      - /media/onetouch5t/pi4/data/nextcloud_test/vhost.d:/etc/nginx/vhost.d:z
      - /media/onetouch5t/pi4/data/nextcloud_test/html:/usr/share/nginx/html:z
      - /var/run/docker.sock:/tmp/docker.sock:z,ro
    networks:
      - proxy-tier

  letsencrypt-companion:
    image: nginxproxy/acme-companion
    restart: always
    volumes:
      - /media/onetouch5t/pi4/data/nextcloud_test/certs:/etc/nginx/certs:z
      - /media/onetouch5t/pi4/data/nextcloud_test/acme:/etc/acme.sh:z
      - /media/onetouch5t/pi4/data/nextcloud_test/vhost.d:/etc/nginx/vhost.d:z
      - /media/onetouch5t/pi4/data/nextcloud_test/html:/usr/share/nginx/html:z
      - /var/run/docker.sock:/var/run/docker.sock:z,ro
    networks:
      - proxy-tier
    depends_on:
      - proxy

networks:
  proxy-tier:
    name: nginx-proxy

portainer picture to show they are all running fine:

nginx log (newest at the top):

nginx.1     | 192.168.1.156 192.168.1.151 - - [04/Aug/2024:20:41:24 +0000] "GET /favicon.ico HTTP/2.0" 503 592 "https://192.168.1.156/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36" "-"
nginx.1     | 192.168.1.156 192.168.1.151 - - [04/Aug/2024:20:41:24 +0000] "GET / HTTP/2.0" 503 592 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36" "-"
mnginx.1     | 192.168.1.156 192.168.1.151 - - [04/Aug/2024:20:35:39 +0000] "GET /favicon.ico HTTP/1.1" 503 592 "http://192.168.1.156/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36" "-"

nginx.1     | 192.168.1.156 192.168.1.151 - - [04/Aug/2024:20:35:39 +0000] "GET / HTTP/1.1" 503 592 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36" "-"
nginx.1     | 2024/08/04 20:34:38 [notice] 20#20: signal 17 (SIGCHLD) received from 39
nginx.1     | 2024/08/04 20:34:38 [notice] 20#20: worker process 40 exited with code 0
nginx.1     | 2024/08/04 20:34:38 [notice] 20#20: worker process 39 exited with code 0
nginx.1     | 2024/08/04 20:34:38 [notice] 20#20: signal 17 (SIGCHLD) received from 40
nginx.1     | 2024/08/04 20:34:38 [notice] 20#20: signal 29 (SIGIO) received
nginx.1     | 2024/08/04 20:34:38 [notice] 20#20: worker process 42 exited with code 0
nginx.1     | 2024/08/04 20:34:38 [notice] 20#20: signal 17 (SIGCHLD) received from 42
nginx.1     | 2024/08/04 20:34:38 [notice] 20#20: worker process 41 exited with code 0
nginx.1     | 2024/08/04 20:34:38 [notice] 20#20: signal 17 (SIGCHLD) received from 41
nginx.1     | 2024/08/04 20:34:38 [notice] 42#42: exit
nginx.1     | 2024/08/04 20:34:38 [notice] 42#42: exiting
nginx.1     | 2024/08/04 20:34:38 [notice] 42#42: gracefully shutting down
nginx.1     | 2024/08/04 20:34:38 [notice] 39#39: exit

my router setting for port forwarding:

It ended up I had to enable both http and https port before I bring the docker up

1 Like