部署在树莓派的Seafile服务器头像无法显示无法上传

默认头像 /media/avatars/default.png

显示 404Not Found

当上传头像时

ccnet.conf

[General]
USER_NAME = Cloud
ID = xxxxxxxxxxxxxxxxxxxxxx
NAME = Cloud
SERVICE_URL = http://127.0.0.1:8802
[Client]
PORT = 13419

seafile.conf

[fileserver]
host = 127.0.0.1
port = 8801
max_upload_size = 200
max_download_dir_size = 200
max_indexing_threads = 2
fixed_block_size = 2
web_token_expire_time = 3600
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER
ENABLE_SIGNUP = False
ACTIVATE_AFTER_REGISTRATION = False
SEND_EMAIL_ON_ADDING_SYSTEM_MEMBER = True
SEND_EMAIL_ON_RESETTING_USER_PASSWD = True
LOGIN_REMEMBER_DAYS = 7
LOGIN_ATTEMPT_LIMIT = 3
FREEZE_USER_ON_LOGIN_FAILED = False
USER_PASSWORD_MIN_LENGTH = 6
USER_PASSWORD_STRENGTH_LEVEL = 3
USER_STRONG_PASSWORD_REQUIRED = False
FORCE_PASSWORD_CHANGE = True
SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_SAVE_EVERY_REQUEST = False
ENABLE_WIKI = True

REPO_PASSWORD_MIN_LENGTH = 8
SHARE_LINK_PASSWORD_MIN_LENGTH = 8
DISABLE_SYNC_WITH_ANY_FOLDER = False
ENABLE_REPO_HISTORY_SETTING = False
ENABLE_USER_CREATE_ORG_REPO = True
ENABLE_SETTINGS_VIA_WEB = False
SITE_NAME = ‘Cloud’
SITE_TITLE = ‘Cloud’
SITE_ROOT = ‘/’

nginx

server {
listen 8800;
server_name pan.it.com;

proxy_set_header X-Forwarded-For $remote_addr;

location / {
    fastcgi_pass    127.0.0.1:8802;
    fastcgi_param   SCRIPT_FILENAME     $document_root$fastcgi_script_name;
    fastcgi_param   PATH_INFO           $fastcgi_script_name;

    fastcgi_param    SERVER_PROTOCOL    $server_protocol;
    fastcgi_param   QUERY_STRING        $query_string;
    fastcgi_param   REQUEST_METHOD      $request_method;
    fastcgi_param   CONTENT_TYPE        $content_type;
    fastcgi_param   CONTENT_LENGTH      $content_length;
    fastcgi_param    SERVER_ADDR        $server_addr;
    fastcgi_param    SERVER_PORT        $server_port;
    fastcgi_param    SERVER_NAME        $server_name;
    fastcgi_param   REMOTE_ADDR         $remote_addr;

    access_log      off;
    error_log  /dev/null;
}

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

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

}

系统日志 ccnet.log

[06/09/17 14:38:51] …/common/session.c(132): using config file /home/seafile/conf/ccnet.conf
[06/09/17 14:38:51] …/common/session.c(455): socket file exists, delete it anyway
[06/09/17 14:38:51] …/common/session.c(484): Listen on /home/seafile/ccnet/ccnet.sock for local clients
[06/09/17 14:38:51] …/common/session.c(290): Update pubinfo file
[06/09/17 14:38:52] …/common/session.c(398): Accepted a local client
[06/09/17 14:38:52] …/common/session.c(398): Accepted a local client
[06/09/17 14:38:52] …/common/session.c(398): Accepted a local client
[06/09/17 14:38:52] …/common/session.c(398): Accepted a local client
[06/09/17 14:39:29] …/common/session.c(398): Accepted a local client
[06/09/17 14:39:29] …/common/peer.c(943): Local peer down
[06/09/17 14:40:33] …/common/session.c(398): Accepted a local client
[06/09/17 14:40:35] …/common/session.c(398): Accepted a local client
[06/09/17 14:40:38] …/common/session.c(398): Accepted a local client
[06/09/17 14:46:27] …/common/peer.c(943): Local peer down
[06/09/17 14:46:27] …/common/peer.c(943): Local peer down
[06/09/17 14:46:27] …/common/peer.c(943): Local peer down
[06/09/17 14:46:37] …/common/session.c(398): Accepted a local client
[06/09/17 14:46:37] …/common/peer.c(943): Local peer down
[06/09/17 14:47:13] …/common/session.c(398): Accepted a local client
[06/09/17 14:47:13] …/common/peer.c(943): Local peer down
[06/09/17 14:47:42] …/common/session.c(398): Accepted a local client
[06/09/17 14:47:51] …/common/session.c(398): Accepted a local client
[06/09/17 14:47:58] …/common/session.c(398): Accepted a local client
[06/09/17 14:48:15] …/common/peer.c(943): Local peer down
[06/09/17 14:48:15] …/common/peer.c(943): Local peer down
[06/09/17 14:48:15] …/common/peer.c(943): Local peer down
[06/09/17 14:48:32] …/common/session.c(369): Exit at Fri Jun 9 14:48:32 2017

系统日志 seahub_django_request.log

2017-06-09 06:40:38,861 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:40:40,586 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:40:41,994 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:40:42,665 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:40:55,687 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:41:04,078 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:41:14,042 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:41:15,006 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:42:01,099 [WARNING] django.request:170 get_response Not Found: /favicon.ico
2017-06-09 06:42:24,514 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:45:06,847 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:45:07,877 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:45:09,480 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:47:55,370 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:48:01,991 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:49:04,578 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:49:06,042 [WARNING] django.request:170 get_response Not Found: /jquery.min.map
2017-06-09 06:49:44,842 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:49:45,700 [WARNING] django.request:170 get_response Not Found: /jquery.min.map
2017-06-09 06:49:46,178 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:50:04,119 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:50:05,269 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:52:26,434 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:52:27,462 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:52:32,627 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:52:32,720 [WARNING] django.request:170 get_response Not Found: /media/assets/css/bootstrap.min.css.map
2017-06-09 06:52:41,824 [ERROR] django.request:256 handle_uncaught_exception Internal Server Error: /avatar/add/
Traceback (most recent call last):
File “/home/seafile/seafile-server-6.0.9/seahub/thirdpart/Django-1.8.17-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.0.9/seahub/seahub/auth/decorators.py”, line 27, in _wrapped_view
return view_func(request, *args, **kwargs)
File “/home/seafile/seafile-server-6.0.9/seahub/seahub/avatar/views.py”, line 76, in add
avatar.avatar.save(image_file.name, image_file)
File “/home/seafile/seafile-server-6.0.9/seahub/thirdpart/Django-1.8.17-py2.7.egg/django/db/models/fields/files.py”, line 93, in save
self.name = self.storage.save(name, content, max_length=self.field.max_length)
File “/home/seafile/seafile-server-6.0.9/seahub/thirdpart/Django-1.8.17-py2.7.egg/django/core/files/storage.py”, line 63, in save
name = self._save(name, content)
File “/home/seafile/seafile-server-6.0.9/seahub/thirdpart/Django-1.8.17-py2.7.egg/django/core/files/storage.py”, line 222, in _save
os.makedirs(directory)
File “/usr/lib/python2.7/os.py”, line 150, in makedirs
makedirs(head, mode)
File “/usr/lib/python2.7/os.py”, line 150, in makedirs
makedirs(head, mode)
File “/usr/lib/python2.7/os.py”, line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 2] No such file or directory: ‘/home/seafile/seafile-server-6.0.9/seahub/media/avatars/5’
2017-06-09 06:52:42,506 [WARNING] django.request:170 get_response Not Found: /favicon.ico
2017-06-09 06:52:52,761 [WARNING] django.request:170 get_response Not Found: /media/assets/css/bootstrap.min.css.map
2017-06-09 06:55:31,772 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:55:35,047 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:57:07,739 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 06:57:08,717 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 08:42:58,130 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 08:42:58,754 [WARNING] django.request:170 get_response Not Found: /media/avatars/default.png
2017-06-09 09:03:21,944 [ERROR] django.request:256 handle_uncaught_exception Internal Server Error: /avatar/add/
Traceback (most recent call last):

:sob: 我检查了所有的配置文件、官方文档和依赖,我没发现任何问题。尝试过重新安装,清楚缓存都无效

默认头像

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

8082这个端口不能改

另外要看看nginx的报错日志。

首先先感谢帮助!我已经自行解决。但是与端口并没有关系,我没有更改端口,现在一切正常。
仔细阅读了官方文档发现文件目录构造是这样的:

haiwen
├── conf                # configuration files
│   ├── ccnet.conf
│   └── seafile.conf
│   └── seahub_settings.py
│   └── seafdav.conf
├── ccnet
│   ├── mykey.peer
│   ├── PeerMgr
│   └── seafile.ini
├── installed
│   └── seafile-server_1.4.0_x86-64.tar.gz
├── seafile-data        
├── seafile-server-1.4.0  # active version
│   ├── reset-admin.sh
│   ├── runtime
│   ├── seafile
│   ├── seafile.sh
│   ├── seahub
│   ├── seahub.sh
│   ├── setup-seafile.sh
│   └── upgrade
├── seafile-server-latest  # symbolic link to seafile-server-1.4.0
├── seahub-data
│   └── avatars
├── seahub.db

其中的avatars我并没有发现有该目录

├── seahub-data
│   └── avatars

该目录是个链接文件指向 -> /seafile-server-latest/seahub/media/avatars
然后我分别ln了两个目录,发现 /seafile-server-latest/seahub/media/avatars 也是个链接文件,同样也链接到 /seafile-server-latest/seahub/media/avatars ? 这很奇怪!
处理方法:
分别在SSH把两个avatars文件夹RM掉。在下载的安装包重新提取avatars文件夹放到/seafile-server-latest/seahub/media/avatars 并且在 /seahub-data/ 文件夹下创建avatars链接文件并指向/seafile-server-latest/seahub/media/avatars 。清空缓存,重启seafile 一切工作正常!
我并不知道这是安装包的问题还是环境的问题,但问题肯定出现在安装顺序里。
论坛发现也有其他相同的问题,希望能帮到他们。

1 个赞

请问楼主是源码安装的还是2进制包。?

正解!已经解决!谢谢楼主了

非常感谢前辈的分享,目前时间线为2019年3月,起码linux端此问题尚未修改。

修改一下,目前是使用的版本6.2.5,Ubuntu端此问题没有被修改。Centos端正常。