最后由 Tabing010102 更新于 2019年9月14日
就在昨天(今天)在查阅私人云盘解决方案的时候看到了Seafile
,原本以为她是一个商业解决方案(像ownCloud
一样),仔细的看了一下,发现是一个主要由中国开发者开发的开源云盘,于是就在(前天)晚上在s3上装了一下
(继续压榨s3),实际上s3上已经有了nextcloud
,这下正好来对比了一下,最后发现Seafile
更加优秀一些。首先Seafile
的内核是由C/Python
驱动的,相比nextcloud
的PHP
效率显然更高一些,具体体现的话,就单从网络载入速度来说,Seafile
远超nextcloud
,而且对服务器资源占用的来说也好很多(指访问的瞬间和同步时的占用率)
从储存方式来说,nextcloud
用的是普通的文件储存,对于文件直接访问和修改、控制等比较方便,Seafile
用的则是自己编写的分块储存法,访问控制相对比较麻烦,个人感觉各有利弊吧。
对于WebDAV
来说,在Windows
下nextcloud
的WebDAV
可以正常访问,可惜Seafile
的不知道怎么就挂掉了,但用其他WebDAV
工具访问时是正常的。
下面大概的记录一下安装流程(实际上官方有中文文档而且很详细):服务器版本linux-x86_64-6.3.4
,在"/home/wwwroot/seafile"
下解压下载的.tar.gz,
yum install python-imaging MySQL-python python-memcached python-ldap python-urllib3 ffmpeg ffmpeg-devel
pip install pillow moviepy
安装:
cd /home/wwwroot/seafile/seafile-server-6.3.4
./setup-seafile-mysql.sh
修改seafile
,seahub
端口,开启seafdav
(webdav
服务):
#/home/wwwroot/seafile/conf/gunicorn.conf
...
# default localhost:8000
bind = "0.0.0.0:8100"
...
#/home/wwwroot/seafile/conf/seafile.conf
[fileserver]
port = 8102
...
(下面的需要nginx进行配置转发)
#/home/wwwroot/seafile/conf/seafdav.conf
[WEBDAV]
enabled = true
port = 8101
fastcgi = true
share_name = /webdav
对于s3的nginx
:
#/usr/local/nginx/conf/vhost/sf3.gyx1.cn
server
{
listen 80;
listen [::]:80;
server_name sf3.gyx1.cn ;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/seafile;
rewrite ^(.*)$ https://$host$1 permanent;
#error_page 404 /404.html;
}
server
{
charset utf-8;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name sf3.gyx1.cn ;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/seafile;
ssl on;
ssl_certificate /usr/local/nginx/conf/ssl/gyx1.cn/fullchain.cer;
ssl_certificate_key /usr/local/nginx/conf/ssl/gyx1.cn/gyx1.cn.key;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/nginx/conf/ssl/dhparam.pem;
#error_page 404 /404.html;
access_log off;
proxy_set_header X-Forwarded-For $remote_addr;
server_tokens off;
location / {
proxy_pass http://127.0.0.1:8100;
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;
#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:8102;
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/wwwroot/seafile/seafile-server-latest/seahub;
}
location /webdav {
fastcgi_pass 127.0.0.1:8101;
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;
client_max_body_size 0;
fastcgi_param HTTPS on;
#access_log /var/log/nginx/seafdav.access.log;
#error_log /var/log/nginx/seafdav.error.log;
}
}
所有的配置均按照强制https
进行配置
但是在接下来的使用中却遇到了一个问题,WebDAV
的问题。同样的情况下,nextcloud
的WebDAV
接口可以完美被Windows
识别,但是Seafile
的就不行,后来也装了客户端,结果一个提示403,一个是不能切换到"/"
下,所以考虑是站点子目录的问题,之后就给WebDAV
服务新加了一个域名,独立映射出去(FastCGI
方式,不能直接反向代理)
修改后的seadav.conf
:
#/home/wwwroot/seafile/conf/seafdav.conf
[WEBDAV]
enabled = true
port = 8101
fastcgi = true
share_name = /
修改后的nginx
配置文件:
#/usr/local/nginx/conf/vhost/sf3.gyx1.cn
server {
listen 80;
listen [::]:80;
server_name sf3.gyx1.cn;
...
}
server {
charset utf-8;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name sf3.gyx1.cn ;
...
}
server {
charset utf-8;
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name sf3-webdav.gyx1.cn ;
...
location / {
fastcgi_pass 127.0.0.1:8101;
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;
client_max_body_size 0;
fastcgi_param HTTPS on;
#access_log /var/log/nginx/seafdav.access.log;
#error_log /var/log/nginx/seafdav.error.log;
}
}
这样WebDAV
服务就可以正确被识别,地址就是https://sf3-webdav.gyx1.cn/
,虽然多加了一个域名,但是现在也只能暂时这么解决了,应该是Seafile
写的时候的问题。
对于树莓派(armv7
),按照教程安装不管是CentOS
还是Raspbian
,都是提示Internal Server Error
,最后翻论坛发现是Python
模块版本的问题,我的话是把pillow
升级到6.0.0
,urllib3
降级到1.10.2
后解决了问题(wsl)
Views: 56