Looking for help with Nginx Proxy Manager

Hello, I install Seafile 9.0.4 with docker-compose like that:

version: '2.0'
services:
  db:
    image: mariadb
    container_name: seafile-mysql
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=.......
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - ./data/mariadb:/var/lib/mysql
    networks:
      - seafile-net

  memcached:
    image: memcached
    container_name: seafile-memcached
    restart: unless-stopped
    entrypoint: memcached -m 256
    networks:
      - seafile-net
          
  seafile:
    image: seafileltd/seafile-mc
    container_name: seafile
    restart: unless-stopped
    ports:
      - "8090:80"
    volumes:
      - ./data/app:/shared
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=.......
      - TIME_ZONE=Etc/UTC
      - SEAFILE_ADMIN_EMAIL=..........@gmail.com
      - SEAFILE_ADMIN_PASSWORD=..........
      - SEAFILE_SERVER_LETSENCRYPT=false
      - SEAFILE_SERVER_HOSTNAME=..........ddns.net/seafile
    depends_on:
      - db
      - memcached
    networks:
      - seafile-net

networks:
  seafile-net:

Then I add seafile to my Nginx Proxy Manager as subfolder in custom locations:
http 127.0.0.1 8090

Next I search in Seafile configuration to add base url /seafile but cannot find that option.
I set in Admin settings>settings
SERVICE_URL: ........net/seafile/
FILE_SERVER_ROOT: .....myserver.......net/seafile/seafhttp
There’s no other option that I can use for base url.

I search in docker-compose folder and find nginx directory: ~/seafile-server/data/app/nginx/conf/seafile.nginx.conf

# -*- mode: nginx -*-
# Auto generated at 03/01/2022 20:44:42
server {
listen 80;
server_name myserver......net/seafile;

    client_max_body_size 10m;

    location / {
        proxy_pass 127.0.0.1:8000/;
        proxy_read_timeout 310s;
        proxy_set_header Host $host;
        proxy_set_header Forwarded "for=$remote_addr;proto=$scheme";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Connection "";
        proxy_http_version 1.1;

        client_max_body_size 0;
        access_log      /var/log/nginx/seahub.access.log seafileformat;
        error_log       /var/log/nginx/seahub.error.log;
    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass 127.0.0.1:8082;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        client_max_body_size 0;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_request_buffering off;
        access_log      /var/log/nginx/seafhttp.access.log seafileformat;
        error_log       /var/log/nginx/seafhttp.error.log;
    }

    location /seafdav {
        proxy_pass         127.0.0.1:8080;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_read_timeout  1200s;
        client_max_body_size 0;

        access_log      /var/log/nginx/seafdav.access.log seafileformat;
        error_log       /var/log/nginx/seafdav.error.log;
    }

    location /media {
        root /opt/seafile/seafile-server-latest/seahub;
    }

    # For letsencrypt
    location /.well-known/acme-challenge/ {
        alias /var/www/challenges/;
        try_files $uri =404;
    }

Do I have to modify that file or delete it if I use NPM?

Seafile works on my local adress: 192.168.0.19:8090 but on myserver…net/seafile I see blank page with languages links.

Regards.

There’s a mess with nginx in their docker container. i’m trying fix almost same issue, but with seafdav.

Thanks for Your answer.
My external site looks that now:

I checked docker-compose logs and I see there’s also some nginx sevice starting, meybe I need to make changes in ~/seafile-server/data/app/nginx/conf/seafile.nginx.conf?
I see there lines:

location / {
        proxy_pass http://127.0.0.1:8000/;

and

location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;

and

location /seafdav {
        proxy_pass         http://127.0.0.1:8080;

I set in docker-compose.yml ports as: 8090:80
Meybe I need to change in that lines?
Regards

@PrzemekSkw,

I wanted to just mention something, when you have an nginx proxy running in docker and it needs to communicate with another container, it’s communicating in parallel. This means your proxy_pass is going to be the internal port - which if you used 8090:80 in docker compose that’s port 80 or just the IP of the seafile docker container such as:

proxy_pass http://ip-of-container/;

Now, of course, the nginx and seafile containers have their own IP addresses outside the local host. Docker containers generally get ips in the 172.17. 0.0/16 address space, but of course these could be manually assigned.

You can dig a little deeper into getting the ips of your containers.

One example - my own setup:
docker-compose.yml of seafile uses ports 8090:80
Ubuntu Server running docker IP: 192.168.1.100
Inside docker, two containers:

  1. Nginx: 10.0.0.100
  2. Seafile: 10.0.0.101

The proxy_pass in my nginx server looks like this:
proxy_pass http://10.0.0.101/;

Hope this helps get you there.
Kevin

Thanks for answer @kevinc , Can You tell me that proxy_pass I need to set in seafile.nginx.conf? What about that ports:
location / {
proxy_pass http://127.0.0.1:8000/;
location /seafhttp {
rewrite ^/seafhttp(.*)$ $1 break;
proxy_pass http://127.0.0.1:8082;
location /seafdav {
proxy_pass http://127.0.0.1:8080;

I have Nginx Proxy Manager set in host mode:
version: ‘3’
services:
nginx-proxy-manager:
image: jlesage/nginx-proxy-manager
restart: unless-stopped
network_mode: host
volumes:
- “/home/dietpi/.config/nginx-proxy-manager:/config:rw”

I see in Portainer I have IPs for Seafile:

  • Seafile = 172.21.0.4
  • Seafile-mysql = 172.21.0.2
  • Seafile-memcached = 172.21.0.3

Can You help me with that becaouse I really don’t understand docker and nginx?
Regards.

Alright, I’ll do what I can… but please tell me more about your setup. Can you tell me what base os you’re using? Also, the seafile.nginx.conf - where did you get that conf file? Was it a template? When you terminal into the seafile (172.21.0.4) container can you ping the nginx container (whatever that IP is) and vice versa?

Also, just share your docker-compose (maybe on pastebin) for seafile and seafile.nginx.conf files (redact personal or sensitive info) and I’ll take a look.

I post my Seafile docker-compose and seafile.nginx.conf in my first post. That seafile.nginx.conf I find in dietpi@DietPi:~/seafile-server/data/app/nginx/conf/seafile.nginx.conf. I never use any nginx conf file. I use Nginx Proxy Manager and add apps as subfolders. Then just set in apps base url and that just works.
I use DietpiOS (debian 11) on HP intel miniPC, kernel 5.10 x86_64.
I don’t know how to ping that Nginx Proxy Manager because I don’t see any IP with docker ps or in Pointainer

dietpi@DietPi:~/seafile-server/data/app/nginx/conf$ docker ps
CONTAINER ID   IMAGE                                COMMAND                  CREATED        STATUS        PORTS                                                                                  NAMES
93142aabc162   mariadb:latest                       "docker-entrypoint.s…"   2 hours ago    Up 2 hours    3306/tcp                                                                               seafile-mysql
8bf08ecc0ffb   seafileltd/seafile-mc                "/sbin/my_init -- /s…"   16 hours ago   Up 16 hours   0.0.0.0:8090->80/tcp, :::8090->80/tcp                                                  seafile
1b58e86d9298   memcached                            "memcached -m 256"       16 hours ago   Up 16 hours   11211/tcp                                                                              seafile-memcached
fbb37b6c6c1a   koenkk/zigbee2mqtt:latest            "docker-entrypoint.s…"   2 days ago     Up 2 days     0.0.0.0:8081->8080/tcp, 0.0.0.0:9999->8080/tcp, :::8081->8080/tcp, :::9999->8080/tcp   zigbee2mqtt
0022ef2e1e7b   lscr.io/linuxserver/wireguard        "/init"                  3 days ago     Up 2 days     0.0.0.0:51820->51820/udp, :::51820->51820/udp                                          wireguard
62569b171261   jlesage/nginx-proxy-manager:latest   "/init"                  9 days ago     Up 2 days                                                                                            npm_nginx-proxy-manager_1
145c06ce4b4f   eclipse-mosquitto:2.0                "/docker-entrypoint.…"   3 weeks ago    Up 2 days     0.0.0.0:1883->1883/tcp, :::1883->1883/tcp, 0.0.0.0:9001->9001/tcp, :::9001->9001/tcp   dietpi_mqtt_1
d6bb53ee93e7   portainer/portainer-ce               "/portainer -H unix:…"   3 weeks ago    Up 2 days     8000/tcp, 9443/tcp, 0.0.0.0:9000->9000/tcp, :::9000->9000/tcp                          portainer
2492862a0f7d   hrfee/jfa-go                         "/opt/jfa-go/jfa-go …"   4 weeks ago    Up 2 days     0.0.0.0:8056->8056/tcp, :::8056->8056/tcp, 8057/tcp                                    jfago
ec78fe2025e1   containrrr/watchtower                "/watchtower"            4 weeks ago    Up 2 days     8080/tcp                                                                               watchtower
dietpi@DietPi:~/seafile-server/data/app/nginx/conf$ 

Regards

Ok, yea… thanks… I should have checked your first post… busy day for me.

But, let’s just do something basic, get into the terminal of your nginx container (use a command like this) - the /bin/sh might need to be /bin/bash:
docker exec -it -u root npm_nginx-proxy-manager_1 /bin/sh

Once in that terminal, do these things to make sure nginx can see seafile:

  1. Ping all the other containers: Seafile = 172.21.0.4, Seafile-mysql = 172.21.0.2, Seafile-memcached = 172.21.0.3 - does that succeed?
  2. Determine where web interfaces might be and see if you can get any data, such as the seafile hub:
    curl -Is http://172.21.0.4 | head -n 1
    This an example, something is there, there will be no response if nothing:
    image

Doing those things might show some things that might be going on, give them a try and let me know and I’ll look at your files in a bit.

  1. Ping works for that three containers:
dietpi@DietPi:~$ docker exec -it -u root npm_nginx-proxy-manager_1 /bin/sh
/tmp # ping 172.21.0.4
PING 172.21.0.4 (172.21.0.4): 56 data bytes
64 bytes from 172.21.0.4: seq=0 ttl=64 time=0.045 ms
64 bytes from 172.21.0.4: seq=1 ttl=64 time=0.049 ms
64 bytes from 172.21.0.4: seq=2 ttl=64 time=0.050 ms
64 bytes from 172.21.0.4: seq=3 ttl=64 time=0.049 ms
64 bytes from 172.21.0.4: seq=4 ttl=64 time=0.050 ms
64 bytes from 172.21.0.4: seq=5 ttl=64 time=0.050 ms
64 bytes from 172.21.0.4: seq=6 ttl=64 time=0.050 ms
^C
--- 172.21.0.4 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 0.045/0.049/0.050 ms
/tmp # ping 172.21.0.2
PING 172.21.0.2 (172.21.0.2): 56 data bytes
64 bytes from 172.21.0.2: seq=0 ttl=64 time=0.076 ms
64 bytes from 172.21.0.2: seq=1 ttl=64 time=0.049 ms
64 bytes from 172.21.0.2: seq=2 ttl=64 time=0.049 ms
64 bytes from 172.21.0.2: seq=3 ttl=64 time=0.049 ms
^C
--- 172.21.0.2 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.049/0.055/0.076 ms
/tmp # ping 172.21.0.3
PING 172.21.0.3 (172.21.0.3): 56 data bytes
64 bytes from 172.21.0.3: seq=0 ttl=64 time=0.090 ms
64 bytes from 172.21.0.3: seq=1 ttl=64 time=0.049 ms
64 bytes from 172.21.0.3: seq=2 ttl=64 time=0.050 ms
^C
--- 172.21.0.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.049/0.063/0.090 ms
/tmp # 
dietpi@DietPi:~$ curl -Is http://172.21.0.4 | head -n 1
HTTP/1.1 302 Found

Regards

@kevinc meybe that is permissions problem?

root@DietPi:/home/dietpi/seafile-server/data/app# ls -l
razem 12
drwxr-xr-x 3 root root 4096 03-01 21:44 logs
drwxr-xr-x 3 root root 4096 03-01 21:44 nginx
drwxr-xr-x 7 root root 4096 03-01 21:44 seafile

root@DietPi:/home/dietpi/seafile-server/data/app/seafile# ls -l
razem 20
drwx------ 2 root root 4096 03-01 21:44 ccnet
drwx------ 3 root root 4096 03-03 21:24 conf
drwxr-xr-x 2 root root 4096 03-01 21:44 logs
drwx------ 6 root root 4096 03-01 21:44 seafile-data
drwxr-xr-x 5 root root 4096 03-02 09:16 seahub-data

root@DietPi:/home/dietpi/seafile-server/data/app/seafile/conf# ls -l
razem 24
-rw-r--r-- 1 root root  212 03-02 22:12 ccnet.conf
-rw-r--r-- 1 root root  299 03-01 21:44 gunicorn.conf.py
drwxr-xr-x 2 root root 4096 03-02 22:14 __pycache__
-rw-r--r-- 1 root root   60 03-01 21:44 seafdav.conf
-rw-r--r-- 1 root root  225 03-02 10:18 seafile.conf
-rwx------ 1 root root  897 03-02 22:14 seahub_settings.py
root@DietPi:/home/dietpi/seafile-server/data/app/seafile/conf# cat seafile.conf 
[fileserver]
port = 8090
host = 127.0.0.1  ## default port 0.0.0.0

[database]
type = mysql
host = db
port = 3306
user = seafile
password = .................................................................
db_name = seafile_db
connection_charset = utf8

root@DietPi:/home/dietpi/seafile-server/data/app/seafile/conf# cat seahub_settings.py 
# -*- coding: utf-8 -*-
SECRET_KEY = "..........................................................."
SERVICE_URL = "https://myserver.ddns.net/seafile"

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'seahub_db',
        'USER': 'seafile',
        'PASSWORD': '...........................................',
        'HOST': 'db',
        'PORT': '3306',
        'OPTIONS': {'charset': 'utf8mb4'},
    }
}


CACHES = {
    'default': {
        'BACKEND': 'django_pylibmc.memcached.PyLibMCCache',
        'LOCATION': 'memcached:11211',
    },
    'locmem': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
    },
}
COMPRESS_CACHE_BACKEND = 'locmem'
TIME_ZONE = 'Etc/UTC'
HTTP_SERVER_ROOT = "https://myserver.ddns.net/seafile/seafhttp"
OFFICE_CONVERTOR_ROOT = 'http://office-preview:8089'
#SITE_ROOT = "https://myserver.ddns.net/seafile"
root@DietPi:/home/dietpi/seafile-server/data/app/seafile/conf# cat ccnet.conf 
[General]
SERVICE_URL = https://myserver.ddns.net/seafile
[Database]
ENGINE = mysql
HOST = db
PORT = 3306
USER = seafile
PASSWD = ..............................................
DB = ccnet_db
CONNECTION_CHARSET = utf8

regards.