Seahub (?): Web Interface / Login-Page broken

Hi there,

I try to get seafile 6.2.5 running on a Raspberry Pi with raspian stretch and nginx 1.10.3 using ssl.

The web interface / login-page broken seems to be broken:

This is my configuration of seafile:

ccnet.conf

[General]
USER_NAME = Seafile_RPi
ID = […]
NAME = Seafile_RPi
SERVICE_URL = https://my.dynamic.ip.xyz

seahub_settings.py

-- coding: utf-8 --

SECRET_KEY = “[…]”
HTTP_SERVER_ROOT = ‘https://my.dynamic.ip.xyz/seafhttp

/etc/nginx/sites-available/seahub

server {
    listen       80;
server_name  my.dynamic.ip.xyz;
    rewrite ^ https://$http_host$request_uri? permanent;    # force redirect htt
p to https
    server_tokens off;
}

server {
    listen 443;
    ssl on;
    ssl_certificate /etc/nginx/ssl/[...].crt;
    ssl_certificate_key /etc/nginx/ssl/[...].key;
    server_name my.dynamic.ip.xyz;
    ssl_session_timeout 5m;
    ssl_session_cache shared:SSL:5m;

    ssl_dhparam /etc/nginx/dhparam.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECD
HE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-CAMELLIA256-SHA:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-SEED-SHA:DHE-RSA-CAMELLIA128-SHA:HIGH:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS';
    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;
      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_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;
     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;

        send_timeout  36000s;
    }
    location /media {
        root /home/user/seafile/seafile-server-latest/seahub;
    }
}

Login with the account created during the installation is possible, the web interface afterwards looks broken, too.

I can access seafile-server via seafile-client on Xubuntu with the account created during the installation, syncing works. Any ideas what to do to make the web interface working?

Bests,
ferderm

Here’s a screen-shot of the web interface after login:

Bests,
ferderm

Seems to be a browser issue. Do you use some Cookie/Scrip blocker ?

With Firefox I use NoScript, my dyndns-domain has an execption. With Chromium (no cookie or script-blocker) it’s all the same.

Seems javascript is disabled, a typically problem. Can you disable noscript for testing complete?

I disabled NoScript. Problem still occurs.

Here’s the output of less seahub_django_request.log:

2018-06-15 07:02:32,686 [WARNING] django.request:170 get_response Not Found: / seafhttp/
2018-06-16 19:59:47,228 [WARNING] django.request:170 get_response Not Found: /favicon.ico
2018-06-16 19:59:47,409 [WARNING] django.request:170 get_response Not Found: /favicon.ico
2018-06-16 20:45:54,556 [WARNING] django.request:170 get_response Not Found: /sitemap.xml
2018-06-16 20:45:55,734 [WARNING] django.request:170 get_response Not Found: /.well-known/security.txt
2018-06-17 12:11:23,695 [WARNING] django.request:170 get_response Not Found: /favicon.ico
2018-06-17 12:11:23,861 [WARNING] django.request:170 get_response Not Found: /favicon.ico
2018-06-17 17:52:20,891 [ERROR] django.request:256 handle_uncaught_exception Internal Server Error: /api2/events/
Traceback (most recent call last):
File “/home/seafile/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/core/handlers/base.py”, line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/home/seafile/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/views/decorators/csrf.py”, line 58, in wrapped_view
return view_func(*args, **kwargs)
File “/home/seafile/seafile-server-6.2.5/seahub/thirdpart/Django-1.8.18-py2.7.egg/django/views/generic/base.py”, line 71, in view
return self.dispatch(request, *args, **kwargs)
File “/home/seafile/seafile-server-6.2.5/seahub/seahub/api2/base.py”, line 23, in dispatch
response = super(APIView, self).dispatch(*a, **kw)
File “/home/seafile/seafile-server-6.2.5/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/views.py”, line 466, in dispatch
response = self.handle_exception(exc)
File “/home/seafile/seafile-server-6.2.5/seahub/seahub/api2/base.py”, line 20, in handle_exception
return super(APIView, self).handle_exception(exc)
File “/home/seafile/seafile-server-6.2.5/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/views.py”, line 454, in dispatch
self.initial(request, *args, **kwargs)
File “/home/seafile/seafile-server-6.2.5/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/views.py”, line 376, in initial
self.perform_authentication(request)
File “/home/seafile/seafile-server-6.2.5/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/views.py”, line 310, in perform_authentication
request.user
File “/home/seafile/seafile-server-6.2.5/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/request.py”, line 353, in getattribute
return super(Request, self).getattribute(attr)
File “/home/seafile/seafile-server-6.2.5/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/request.py”, line 193, in user
self._authenticate()
File “/home/seafile/seafile-server-6.2.5/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/request.py”, line 316, in _authenticate
user_auth_tuple = authenticator.authenticate(self)
File “/home/seafile/seafile-server-6.2.5/seahub/seahub/api2/authentication.py”, line 62, in authenticate
ret = self.authenticate_v2(request, key)
File “/home/seafile/seafile-server-6.2.5/seahub/seahub/api2/authentication.py”, line 98, in authenticate_v2
user = User.objects.get(email=token.user)
File “/home/seafile/seafile-server-6.2.5/seahub/seahub/base/accounts.py”, line 93, in get
emailuser = ccnet_threaded_rpc.get_emailuser(email)
File “/home/seafile/seafile-server-6.2.5/seafile/lib/python2.7/site-packages/pysearpc/client.py”, line 110, in newfunc
ret_str = self.call_remote_func_sync(fcall_str)
File “/home/seafile/seafile-server-6.2.5/seafile/lib/python2.7/site-packages/ccnet/rpc.py”, line 71, in call_remote_func_sync
client = self.pool.get_client()
File “/home/seafile/seafile-server-6.2.5/seafile/lib/python2.7/site-packages/ccnet/pool.py”, line 29, in get_client
client = self._create_client()
File “/home/seafile/seafile-server-6.2.5/seafile/lib/python2.7/site-packages/ccnet/pool.py”, line 21, in _create_client
client.connect_daemon()
File “/home/seafile/seafile-server-6.2.5/seafile/lib/python2.7/site-packages/ccnet/client.py”, line 131, in connect_daemon
return self.connect_daemon_with_pipe()
File “/home/seafile/seafile-server-6.2.5/seafile/lib/python2.7/site-packages/ccnet/client.py”, line 113, in connect_daemon_with_pipe
raise NetworkError(“Can’t connect to daemon”)
NetworkError: Can’t connect to daemon
2018-06-17 18:21:57,276 [WARNING] django.request:170 get_response Not Found: /favicon.ico
2018-06-17 18:21:57,401 [WARNING] django.request:170 get_response Not Found: /favicon.ico

Does nginx need some special package/lib for javascript?

Edit 2018-06-18: I tested Chrome/Win10 as a browser, too: The web interface looks the same way.

Can you please post your seahub_settings.py?

Have you tried clearing the seahub cache in the tmp folder on your server? From time to time I have this problem, and clearing that cache works.

Here’s seahub_settings.py:

– coding: utf-8 –
SECRET_KEY = “[…]”

HTTP_SERVER_ROOT = ‘https://my.dynamic.ip.xyz/seafhttp’

I cleared the cache this way:

seafile@raspberrypi:/tmp/seahub_cache $ /home/seafile/seafile-server-latest/seafile.sh stop

Stopping seafile server ...
Done.
seafile@raspberrypi:/tmp/seahub_cache $ /home/seafile/seafile-server-latest/seahub.sh stop

Stopping seahub ...
Done.

seafile@raspberrypi:/tmp/seahub_cache $ rm /tmp/seahub_cache/*
seafile@raspberrypi:/tmp/seahub_cache $ ls -la
total 8
drwx------  2 seafile seafile 4096 Jun 18 20:12 .
drwxrwxrwt 12 root    root    4096 Jun 18 20:12 ..
seafile@raspberrypi:/tmp/seahub_cache $ /home/seafile/seafile-server-latest/seafile.sh start

[06/18/18 20:13:25] ../common/session.c(132): using config file /home/seafile/conf/ccnet.conf
Starting seafile server, please wait ...
Seafile server started

Done.
seafile@raspberrypi:/tmp/seahub_cache $ /home/seafile/seafile-server-latest/seahub.sh start

LC_ALL is not set in ENV, set to en_US.UTF-8
/home/seafile/seafile-server-latest/seahub.sh: line 209: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory
Starting seahub at port 8000 ...

Seahub is started

Done.

The web interface still looks the same (broken) way.

Can you do an “ls -al” on the following two folders and paste the contents here?

/home/user/seafile/seafile-server-latest/seahub

/home/user/seafile/seafile-server-latest/seahub/media

I just went back through your logs and saw this. I checked the code in the python script and it’s trying to connect to the ccnet deamon with the config folder and pipe name. However, that’s failing.

Can you try bypassing NGinx by connecting to it via the internal ip of the server with port 8000 rather than the url name? If the problem persists, then the issue lies within something in Seafile. If it works, then our problem is probably with NGinx or your certificate.

1 Like

Please check the nginx-user (probably “nobody”) is allowed to access /home/user/seafile/seafile-server-latest/seahub. Especially if nginx-user has +x on every dir in that line. I ran into a similar problem, that’s why I’m asking

That’s one of my suspicions as well, which is why I requested that ls -al on that folder. But, the other error related to connecting to the ccnet daemon is likely related.

pi@raspberrypi:~ $ ls -la /home/seafile/seafile-server-latest/seahub
total 204
drwxr-xr-x 12 seafile seafile 4096 Jan 28 08:42 .
drwxr-xr-x 6 seafile seafile 4096 Jan 28 09:13 …
-rwxr-xr-x 1 seafile seafile 1012 Jan 23 03:36 code-check.sh
-rw-r–r-- 1 seafile seafile 555 Jan 23 03:36 CONTRIBUTORS
drwxr-xr-x 2 seafile seafile 4096 Jan 23 03:36 fabfile
-rw-r–r-- 1 seafile seafile 2644 Jan 23 03:36 HACKING
-rwxr-xr-x 1 seafile seafile 3318 Jan 23 03:36 i18n.sh
-rw-r–r-- 1 seafile seafile 41 Jan 28 08:42 latest_commit
-rw-r–r-- 1 seafile seafile 69540 Jan 23 03:36 LICENSE-thirdparty.txt
-rw-r–r-- 1 seafile seafile 555 Jan 23 03:36 LICENSE.txt
drwxr-xr-x 51 seafile seafile 4096 Jan 23 03:36 locale
-rw-r–r-- 1 seafile seafile 1097 Jan 23 03:36 Makefile
-rwxr-xr-x 1 seafile seafile 249 Jan 23 03:36 manage.py
drwxr-xr-x 11 seafile seafile 4096 Jun 16 22:07 media
-rw-r–r-- 1 seafile seafile 9063 Jan 23 03:36 pylintrc
-rw-r–r-- 1 seafile seafile 9064 Jan 23 03:36 pylintrc.template
-rw-r–r-- 1 seafile seafile 101 Jan 23 03:36 pytest.ini
-rw-r–r-- 1 seafile seafile 1417 Jan 23 03:36 README.markdown
-rw-r–r-- 1 seafile seafile 396 Jan 23 03:36 requirements.txt
-rwxr-xr-x 1 seafile seafile 48 Jan 23 03:36 run-seahub.sh.template
drwxr-xr-x 31 seafile seafile 4096 Jun 13 21:35 seahub
-rwxr-xr-x 1 seafile seafile 310 Jan 23 03:36 send_user_notifications.sh.template
-rw-r–r-- 1 seafile seafile 224 Jan 23 03:36 setenv.sh.template
drwxr-xr-x 2 seafile seafile 4096 Jan 23 03:36 sql
drwxr-xr-x 4 seafile seafile 4096 Jan 23 03:36 static
-rw-r–r-- 1 seafile seafile 109 Jan 23 03:36 test-requirements.txt
drwxr-xr-x 6 seafile seafile 4096 Jan 23 03:36 tests
drwxr-xr-x 29 seafile seafile 4096 Jun 13 20:47 thirdpart
drwxr-xr-x 2 seafile seafile 4096 Jan 23 03:36 tools
-rw-r–r-- 1 seafile seafile 890 Jan 23 03:36 .travis.yml
drwxr-xr-x 2 seafile seafile 4096 Jan 23 03:36 .tx

pi@raspberrypi:~ $ ls -la /home/seafile/seafile-server-latest/seahub/media/
total 44
drwxr-xr-x 11 seafile seafile 4096 Jun 16 22:07 .
drwxr-xr-x 12 seafile seafile 4096 Jan 28 08:42 …
drwxr-xr-x 5 seafile seafile 4096 Jan 23 03:36 assets
lrwxrwxrwx 1 seafile seafile 28 Jun 13 20:43 avatars → …/…/…/seahub-data/avatars
drwxr-xr-x 3 seafile seafile 4096 Jun 16 22:07 CACHE
drwxr-xr-x 2 seafile seafile 4096 Jan 23 03:36 codemirror
drwxr-xr-x 2 seafile seafile 4096 Jan 23 03:36 cors
drwxr-xr-x 5 seafile seafile 4096 Jan 23 03:36 css
drwxr-xr-x 5 seafile seafile 4096 Jan 23 03:36 img
drwxr-xr-x 5 seafile seafile 4096 Jan 23 03:36 js
drwxr-xr-x 2 seafile seafile 4096 Jan 23 03:36 office-template
drwxr-xr-x 5 seafile seafile 4096 Jan 23 03:36 rest_framework

@dennis: How can I check the permissions of a specific user on a folder/file? I’m familiar with ls -la, only.

I’m not completely sure where to put that bypass. nginx, ccnet.conf or seahub_settings.py? It it’s nginx, please give me a hint for the line… Thank you a lot!

It won’t matter. Your permissions are the same as mine. The only difference is you don’t have hardlink called custom under media, which points to seahub-date/custom. I navigated there, and the hardlink is pointing to something that doesn’t exist, but mine is working fine.

As for bypassing NGinx, you just access Seafile directly. For example, let’s say you have the following setup:

NGinx listening on port 443
Domain name (service_url) of https://seafile.mydomain.com
Public ip of 199.199.199.199 which DNS resolves to mydomain.com
NGinx proxy forward to http://127.0.0.1:8000
Internal IP address of 192.168.1.200 on the Linux server hosting NGinx and Seafile

So, here’s what happens.

You open a browser and key https://seafile.mydomain.com.
NGinx reverse proxies the request to http://127.0.0.1:8000

What you can do to bypass NGinx is bypass the reverse proxy by keying the internal ip address into your browser from a machine within the network by using http://192.168.1.200:8000, or on the host server by using http://127.0.0.1:8000.

What this does is two things:
Bypasses NGinx
Bypasses https

At that point, if it works, the first thing I would do would be to check my settings and make certain the service url and the file server url are set properly.

ls -la is perfectly fine.

The x in front of the “11” says that any user is allowed to enter this directory, it should be set in every higher directory, eg. in seahub, seafile-server-latest and so on. Most likely it will be this way and that means nginx can access stuff just fine.

This is just to answer the question, if wthess says it doesn’t matter it really doesn’t matter. Didn’t mean to cause confusion, sorry if I did.

Nah… Didn’t cause any confusion at all. It’s certainly relevant information. His permissions are the same as mine and mine is working fine. I had hoped that it was a simple permissions issue, but it doesn’t seem to be so. Now, I’m thinking it’s got something to do with the following error in his logs