Setup Seafile 7.0.5 with NGINX (ssl) and memcached

Hello,
I keep trying to set up a seafile server 7.0.5 on ubuntu 18.04 behind nginx (with ssl, managed by certbot) and memcached.
I tried to follow the server manual as closely as possible, yet I cannot figure out my problem: All processes start (I find the PID), yet when I access seahub via browser I get “Page unavailable - Sorry, but the requested page is unavailable due to a server hiccup.”

Unfortunately, log files seem not to help.

I believe that I may have to do with SERVICE_URL or similar - I do not know whether it shoulb be “http” or “https”:

Any thoughts - below are my conf files:

ccnet:

[General]
USER_NAME = **********
ID = ************
NAME = ******
SERVICE_URL = https://seafile.**********.de

[Client]
PORT = 13419

[Database]
ENGINE = mysql
HOST = 127.0.0.1
PORT = 3306
USER = ******
PASSWD = *********
DB = ccnet-db
CONNECTION_CHARSET = utf8

gunicorn.conf

import os

daemon = True
workers = 5
bind = “localhost:8000”

pids_dir = ‘/opt/seafile/pids’
pidfile = os.path.join(pids_dir, ‘seahub.pid’)

timeout = 1200

limit_request_line = 8190

seafile.conf

[fileserver]
port = 8082
host=127.0.0.1

[database]
type = mysql
host = 127.0.0.1
port = 3306
user = *********
password = ***********
db_name = seafile-db
connection_charset = utf8

seahub_setting.py

SECRET_KEY = "*************
FILE_SERVER_ROOT = ‘https://seafile.******** .de/seafhttp’
ALLOWED_HOSTS = [‘.********.de’]
ENABLE_SIGNUP = False
LOGIN_REMEBER_DAYS = 1
LOGIN_ATTEMPT_LIMIT = 5
USER_PASSWORD_MIN_LENGTH = 8
ENABLE_WIKI = True
ENABLE_REPO_SNAPSHOT_LABEL = True

SHARE_LINK_PASSWORD_MIN_LENGTH = 8

DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: ‘seahub-db’,
‘USER’: ‘********’,
‘PASSWORD’: ‘**********’,
‘HOST’: ‘127.0.0.1’,
‘PORT’: ‘3306’
}
}

CACHES = {
‘default’: {
‘BACKEND’: ‘django_pylibmc.memcached.PyLibMCCache’,
‘LOCATION’: ‘127.0.0.1:11211’,
},
‘locmem’: {
‘BACKEND’: ‘django.core.cache.backends.locmem.LocMemCache’,
},
}
COMPRESS_CACHE_BACKEND = ‘locmem’

nginx config file:

log_format seafileformat ‘$http_x_forwarded_for $remote_addr [$time_local] “$request” $status $body_bytes_sent “$http_referer” “$http_user_agent” $upstream_response_time’;

server {
if ($host = seafile.********* .de) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name seafile.******** .de www.seafile.*******.de;
return 404; # managed by Certbot
}

server {
server_name seafile.****** .de www.seafile.********* .de;
listen 443 ssl; # managed by Certbot
ssl on;
ssl_certificate /etc/letsencrypt/live/seafile.*******.de/some_name.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/seafile.********.de/some_name.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
proxy_read_timeout 1200s;
add_header Strict-Transport-Security “max-age=31536000” always;
server_tokens off;

location / {
     proxy_pass         http://127.0.0.1:8000;
     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_read_timeout  1200s;

     # used for view/edit office file via Office Online Server
     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 http://127.0.0.1:8082;
    client_max_body_size 0;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_connect_timeout  36000s;
    proxy_read_timeout  36000s;
    proxy_send_timeout  36000s;
    proxy_request_buffering off;

send_timeout 36000s;
access_log /var/log/nginx/seafhttp.access.log seafileformat;
error_log /var/log/nginx/seafhttp.error.log;
}

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

}

If you had any further idea how to debug this please let me know. Any thought welcome.

Yours
Raspy

you could start deactivating memcached block on seahub_settings.py. Seahub will use a temporal directory under /tmp/seahub_cache. Try to open more the bind port on gunicorn.conf.
change bind = “localhost:8000” to bind = “0.0.0.0:8000”

ok - deleted the lines about memcache and changed gunicorn.
Seahub starts and I can log on, yet I cannot upload or downlad any files. So memcached is definitely part of my problem.

When I monitor the interface eth0 with
sudo tcptrack -i eth0

I see that all requests go to port 443, so there is no leakage on port 8000 or 8082 (good).

But: I cannot upload or download any files.
When I try to download, nginx reports an error (without error code).
Uploading just freezes the screen.

ccnet.log, seafile.log and seahub.log are not logging anything.

nginx access log only gives me:

192.168..* - - [27/Apr/2020:17:57:11 +0000] “GET /media/fontawesome/css/fontawesome-all.min.css HTTP/1.1” 200 32490 “https://seafile..de/library/7723bd3d-**” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:75.0) Gecko/20100101 Firefox/75.0”

Any further ideas? Something must be wrong with nginx. Yet I do not know where to start.

go to the admin page in seahub and check the configuration there that it matches to the seahub_settings. Specially the FILE_SERVER_ROOT and SERVICE_URL, like here is wroten:
https://download.seafile.com/published/seafile-manual/deploy/https_with_nginx.md

Thx this works! I had a typo.
Will work on memcached separately, good for now and highly appreciate your time and effort!

gerne / glad I could help. I think the offending lines in second local cache block in seahub_settings.py coul be the these:

‘locmem’: {
‘BACKEND’: ‘django.core.cache.backends.locmem.LocMemCache’,
},
}
COMPRESS_CACHE_BACKEND = ‘locmem’

but not really sure about it.