0

I'm trying to deploy a Seafile service in my home server using docker-compose and have its secure connection managed by a nginx-proxy service by another docker-compose file.

In theory if I comment out the ports section in the Seafile docker-compose file and add the VIRTUAL_PORT=433 and VIRTUAL_HOST=seafile.mydomain.com environment variables, and have both nginx-proxy and Seafile services connected to the same external network in docker, this should work, but it doesn't. In the docker logs for nginx-proxy it gives me an upstream connection error to the Seafile service. I even tested the nginx-proxy service using the nginx-dummy container with exactly the same configuration and it just works (docker run --rm --name nginx-dummy -e VIRTUAL_HOST=test.mydomain.com -e LETSENCRYPT_HOST=test.mydomain.com -e VIRTUAL_PORT=443 --network net -d nginx:latest).

I even tried having the Seafile service to use its own built-in SSL capabilities using custom ports (- "8000:80" and - 8443:443), but it jsut don't work (it only works using the 80 and 433 ports directly, but that unables me to use nginx-proxy for other docker services in the same machine.

Currently I'm using this docker-compose for nginx-proxy:

version: "3.7"

services:

    reverse-proxy:
        image: "jwilder/nginx-proxy:latest"
        container_name: "reverse-proxy"
        volumes:
            - "/home/user/nginx-docker/data/var/docker/nginx/html:/usr/share/nginx/html"
            - "/home/user/nginx-docker/data/var/docker/nginx/vhost:/etc/nginx/vhost.d"
            - "/home/user/nginx-docker/data/var/docker/nginx/certs:/etc/nginx/certs"
            - "/home/user/nginx-docker/data/conf:/etc/nginx/conf.d"
            - "/var/run/docker.sock:/tmp/docker.sock:ro"
        restart: "always"
        networks:
            - "net"
        ports:
            - "80:80"
            - "443:443"

    letsencrypt:
        image: "jrcs/letsencrypt-nginx-proxy-companion:latest"
        container_name: "letsencrypt-helper"
        volumes:
            - "/home/user/nginx-docker/data/var/docker/nginx/html:/usr/share/nginx/html"
            - "/home/user/nginx-docker/data/var/docker/nginx/vhost:/etc/nginx/vhost.d"
            - "/home/user/nginx-docker/data/var/docker/nginx/certs:/etc/nginx/certs"
            - "/home/user/nginx-docker/data/var/docker/nginx/acme:/etc/acme.sh"
            - "/var/run/docker.sock:/var/run/docker.sock:ro"
        environment:
            NGINX_PROXY_CONTAINER: "reverse-proxy"
            DEFAULT_EMAIL: "user@mydomain.com"
        restart: "always"
        depends_on:
            - "reverse-proxy"
        networks:
            - "net"

networks:
  net:
    external: true

And it works fine.

And this is my docker-file for Seafile, that I can only use if I don't use nginx-proxy or any other service that would use 80 and 443 ports:

version: '2.0'
services:
  db:
    image: mariadb:10.6
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /home/user/seafile-docker/data/db:/var/lib/mysql
    networks:
      - seafile-net

  memcached:
    image: memcached:1.6.18
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net

  seafile:
    image: seafileltd/seafile-mc:latest
    container_name: seafile
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /home/user/seafile-docker/data/data:/shared
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=password
      - TIME_ZONE=Continent/City
      - SEAFILE_ADMIN_EMAIL=user@mydomain.com
      - SEAFILE_ADMIN_PASSWORD=password
      - SEAFILE_SERVER_LETSENCRYPT=true
      - SEAFILE_SERVER_HOSTNAME=seafile.mydomain.com
depends_on:
      - db
      - memcached
    networks:
      - seafile-net

networks:
  seafile-net:

0 Answers0