Nginx port forwarding problem

Hello,

I have set up a Raspi with Seafile and radicale. Radicale works like a charm, but I have some problems with seafile. Basically the server runs and syncs with the desktop clients and webDAV on my phone.
The problems I have:

I am unsure whether or not these errors are related. At least the last one looks like a nginx configuration problem. I have searched both in the community manual and in the forum and already tried some things which worked for others with apparently similar problems.

Here are some of my config files:

/etc/nginx/sites-enabled/seahub

server {
    listen       80;
    server_name  xxx.mooo.com;
    rewrite ^ https://$http_host$request_uri? permanent;    # force redirect http to https
    server_tokens off;
}
server {
    listen 443;
    ssl on;
    ssl_certificate xxx/xxx.crt;        # path to your cacert.pem
    ssl_certificate_key xxx/xxx.key;    # path to your privkey.pem
    server_name xxx.mooo.com;
    ssl_session_timeout 5m;
    ssl_session_cache shared:SSL:5m;

    # Diffie-Hellman parameter for DHE ciphersuites, recommended 2048 bits
    ssl_dhparam xxx/dhparam.pem;

    # secure settings (A+ at SSL Labs ssltest at time of writing)
    # see https://wiki.mozilla.org/Security/Server_Side_TLS#Nginx
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'xxx'
    ssl_prefer_server_ciphers on;

    proxy_set_header X-Forwarded-For $remote_addr;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
    server_tokens off;

    location / {
        proxy_pass         http://127.0.0.1:8000;
        proxy_set_header   Host $host:$server_port;
        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 https;

        access_log      /var/log/nginx/seahub.access.log;
        error_log       /var/log/nginx/seahub.error.log;

        proxy_read_timeout  1200s;

        client_max_body_size 0;
    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;
    }


location /seafdav {
    proxy_pass         http://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 https;
    proxy_http_version 1.1;
    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;
    send_timeout  36000s;

    # This option is only available for Nginx >= 1.8.0. See more details below.
    client_max_body_size 0;
    proxy_request_buffering off;

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

location /radicale/ { 
	proxy_pass        http://localhost:5232/; 
	include proxy_params;
	proxy_set_header  X-Script-Name /radicale;
	proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_pass_header Authorization;
	proxy_ssl_certificate         xxx/xxx.crt;
	proxy_ssl_certificate_key     xxx/xxx.key;
}

}

ccnet.conf

[General]
USER_NAME = xxx
ID = xxx
NAME = xxx
SERVICE_URL = https://xxx.mooo.com # had :8000 specified before, makes no difference

[Client]
PORT = 13419

gnuicorn.conf

import os

daemon = True
workers = 5

# default localhost:8000
bind = "0.0.0.0:8000"

# Pid
pids_dir = '/home/seafile/pids'
pidfile = os.path.join(pids_dir, 'seahub.pid')

# for file upload, we need a longer timeout value (default is only 30s, too sho$
timeout = 1200
limit_request_line = 8190

seahub_settings.py

# -*- coding: utf-8 -*-
SECRET_KEY = "xxx"
FILE_SERVER_ROOT = 'https://xxx.mooo.com/seafhttp'
#### added new
USE_X_FORWARDED_HOST = True
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

In the seahub.log I find a lot of django uncaught exceptions:

2020-02-18 12:45:21,966 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /api2/repos/9484d688-045d-409a-89a0-ab5ae7773078/dir/

seafdav.log is full of those, although it seems to work

[2020-02-19 09:19:06,047]:  Init seahub database...
[2020-02-19 09:19:06,051]:  Failed to init seahub db: No module named seahub_settings.

It would be great if somebody could push me into the right direction with these errors!

In my gunicorn.conf it says:
# default localhost:8000
bind = “127.0.0.1:8000”

Thanks for your reply Tjelfe. I changed my gunicorn.conf and changed the service URL in the web interface and now I can see my avatar and share links work!

But I still get the same small error flags in the web interface and cannot see libraries in the app.

Before the change I got this in my controller.log, since the change I don’t have entries in the log files, although the same problems occur.

[02/20/20 07:50:13] seafile-controller.c(634): shutting down ccnet-server ...
[02/20/20 07:50:15] seafile-controller.c(175): starting ccnet-server ...
[02/20/20 07:50:15] seafile-controller.c(79): spawn_process: ccnet-server -F /home/seafile/conf -c /home/seafile/ccnet -f /home/seafile/logs/ccnet.log -d -P /home/seafile/pids/ccnet.pid
[02/20/20 07:50:15] seafile-controller.c(94): spawned ccnet-server, pid 10042
[02/20/20 07:50:16] seafile-controller.c(623): ccnet daemon connected.
[02/20/20 07:50:16] seafile-controller.c(207): starting seaf-server ...
[02/20/20 07:50:16] seafile-controller.c(79): spawn_process: seaf-server -F /home/seafile/conf -c /home/seafile/ccnet -d /home/seafile/seafile-data -l /home/seafile/logs/seafile.log -P /home/seafile/pids/seaf-server.pid
[02/20/20 07:50:16] seafile-controller.c(94): spawned seaf-server, pid 10046
[02/20/20 07:50:16] seafile-controller.c(464): path /proc/27584 doesn't exist, restart progress [2]
[02/20/20 07:50:16] seafile-controller.c(79): spawn_process: /usr/bin/python2.7 -m wsgidav.server.run_server --log-file /home/seafile/logs/seafdav.log --pid /home/seafile/pids/seafdav.pid --port 8080 --host 0.0.0.0
[02/20/20 07:50:16] seafile-controller.c(94): spawned /usr/bin/python2.7, pid 10047

ccnet.log shows this, 7:50 am is probably when my phone connected to the server.

[02/20/20 07:50:13] ../common/session.c(369): Exit at Thu Feb 20 07:50:13 2020

[02/20/20 07:50:15] ../common/session.c(132): using config file /home/seafile/conf/ccnet.conf
[02/20/20 07:50:15] ../common/session.c(455): socket file exists, delete it anyway
[02/20/20 07:50:15] ../common/session.c(484): Listen on /home/seafile/ccnet/ccnet.sock for local clients
[02/20/20 07:50:15] ../common/session.c(290): Update pubinfo file
[02/20/20 07:50:16] ../common/session.c(398): Accepted a local client
[02/20/20 07:50:16] ../common/session.c(398): Accepted a local client
[02/20/20 07:50:17] ../common/session.c(398): Accepted a local client
[02/20/20 07:50:17] ../common/session.c(398): Accepted a local client
[02/20/20 07:50:31] ../common/session.c(398): Accepted a local client
[02/20/20 07:50:31] ../common/peer.c(943): Local peer down
[02/20/20 07:52:00] ../common/session.c(398): Accepted a local client
[02/20/20 07:52:04] ../common/session.c(398): Accepted a local client
[02/20/20 07:52:05] ../common/session.c(398): Accepted a local client
[02/20/20 07:52:05] ../common/session.c(398): Accepted a local client
[02/20/20 07:52:05] ../common/session.c(398): Accepted a local client
[02/20/20 07:53:45] ../common/session.c(398): Accepted a local client
[02/20/20 07:56:12] ../common/session.c(398): Accepted a local client
[02/20/20 07:56:12] ../common/session.c(398): Accepted a local client

seahub.log:

2020-02-20 07:52:21,271 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /api/v2.1/repos/92fe8a9e-6694-4377-876b-7b375c81df9f/repo-tags/
Traceback (most recent call last):
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/djangorestframework-3.3.3-py2.7.egg/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/djangorestframework-3.3.3-py2.7.egg/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.5/seahub/seahub/api2/endpoints/repo_tags.py", line 59, in get
    for file_tag in files_tags:
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/db/models/query.py", line 250, in __iter__
    self._fetch_all()
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/db/models/query.py", line 1121, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
OperationalError: no such table: file_tags_filetags
2020-02-20 07:52:21,453 [ERROR] seahub.api2.endpoints.dir:97 get_dir_file_info_list no such table: file_tags_filetags
2020-02-20 07:53:33,079 [WARNING] django.request:152 get_response Not Found: /cgi-bin/welcome
2020-02-20 07:54:00,774 [ERROR] django.request:135 handle_uncaught_exception Internal Server Error: /api2/repos/9484d688-045d-409a-89a0-ab5ae7773078/dir/
Traceback (most recent call last):
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.5/seahub/seahub/api2/base.py", line 23, in dispatch
    response = super(APIView, self).dispatch(*a, **kw)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/djangorestframework-3.3.3-py2.7.egg/rest_framework/views.py", line 466, in dispatch
    response = self.handle_exception(exc)
  File "/home/seafile/seafile-server-7.0.5/seahub/seahub/api2/base.py", line 20, in handle_exception
    return super(APIView, self).handle_exception(exc)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/djangorestframework-3.3.3-py2.7.egg/rest_framework/views.py", line 463, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/seafile/seafile-server-7.0.5/seahub/seahub/api2/views.py", line 3550, in get
    return get_dir_entrys_by_id(request, repo, path, dir_id, request_type)
  File "/home/seafile/seafile-server-7.0.5/seahub/seahub/api2/views.py", line 2098, in get_dir_entrys_by_id
    files_tags_in_dir = get_files_tags_in_dir(repo.id, path)
  File "/home/seafile/seafile-server-7.0.5/seahub/seahub/utils/file_tags.py", line 23, in get_files_tags_in_dir
    for file_tag in files_tags:
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/db/models/query.py", line 250, in __iter__
    self._fetch_all()
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/db/models/query.py", line 1121, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/home/seafile/seafile-server-7.0.5/seahub/thirdpart/Django-1.11.16-py2.7.egg/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
OperationalError: no such table: file_tags_filetags
2020-02-20 08:17:58,690 [ERROR] seahub.api2.endpoints.dir:97 get_dir_file_info_list no such table: file_tags_filetags

seafile.log:

[02/20/20 07:50:13] Disconnected from daemon
[02/20/20 07:50:17] http-server.c(175): fileserver: worker_threads = 10
[02/20/20 07:50:17] http-server.c(190): fileserver: fixed_block_size = 8388608
[02/20/20 07:50:17] http-server.c(205): fileserver: web_token_expire_time = 3600
[02/20/20 07:50:17] http-server.c(220): fileserver: max_indexing_threads = 1
[02/20/20 07:50:17] http-server.c(235): fileserver: max_index_processing_threads= 3
[02/20/20 07:50:17] http-server.c(257): fileserver: cluster_shared_temp_file_mode = 600
[02/20/20 07:50:17] ../common/mq-mgr.c(54): [mq client] mq cilent is started

Sorry mate, that’s beyond my knowledge.