seafile 配置文件解析

部署 seafile 使用Nginx:

部署 Seahub/FileServer 使用Nginx:
Seahub 是Seafile server的文件接口,

FileServer是用于处理文件上传下载通过浏览器

默认是8082端口

nginx 配置:

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    #add_header X-Frame-Options SAMEORIGIN;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;
server {
    listen 8000;
    server_name 10.4.48.2;

    proxy_set_header X-Forwarded-For $remote_addr;

    location / {
        fastcgi_pass    127.0.0.1:18000;
        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      logs/seahub.access.log;
        error_log       logs/seahub.error.log;
    }

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:18082;
        client_max_body_size 0;
    }
	

    location /media {
        root G:seafile-server_5.0.3_win32seafile-server-5.0.3seahub;
    }
}
}

////修改 ccnet.conf

你可以修改SERVICE_URL通过UI 在系统管理->设置

注意:如果你设置值通过WEB UI 和ccnet.conf  WEB UI设置会生效

ccnt.conf 配置:
[General]
USER_NAME = my-seafile
ID = 5bc4ed29f4478991410427c1fb6ebdcb4a9a5eeb
NAME = my-seafile
SERVICE_URL = http://10.4.48.2:8000

[Network]
PORT = 10001

[Client]
PORT = 13418

[Database]
ENGINE=mysql
HOST=10.4.24.66
USER=root
PASSWD=1234567
DB=ccnet-db
CONNECTION_CHARSET=utf8
MAX_CONNECTIONS=200



//
seafile.conf配置:
[database]
type=mysql
host=10.4.24.66
user=root
password=1234567
db_name=seafile-db
CONNECTION_CHARSET=utf8
max_connections=200
[network]
port = 12001

[fileserver]
port = 18082

[seahub]
port = 18000
fastcgi=true

[quota]
default=2

[fileserver]
max_upload_size=1000

max_download_dir_size=1000


//Modify seahub_settings.py
你需要添加一行在seahub_settings.py 来设置FILE_SERVER_ROOT. 



seahub_settings.py 配置:
SECRET_KEY = 'BHHlzsKHou2aSEC4vGAn8TJOeOAL/NnU4xqgp4UfbPOYVltiGjxLCgoAAAAAAAAAYHbPAPj8IwCFfEAAqEYTAaEsQQAAAAAA4S4AAJIfAAAAAAAAAAAAAKhGEwERJwAAAAAAAKhGEwEoHbx3wTwAAGB2zwA4/SMAzYNAAMCczwBEAAAAAAAAAAAAAADKJCgAAQAAADj9IwBjj0AAPDJBAA=='
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'USER' : 'root',
        'PASSWORD' : '1234567',
        'NAME' : 'seahub-db',
        'HOST' : '10.4.24.66',
        'OPTIONS': {
            "init_command": "SET storage_engine=INNODB",
        }
    }
}

FILE_SERVER_ROOT = 'http://10.4.48.2:8000/seafhttp'

FILE_PREVIEW_MAX_SIZE = 30 * 1024 * 1024

SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2


SESSION_SAVE_EVERY_REQUEST = False


SESSION_EXPIRE_AT_BROWSER_CLOSE = True


ENABLE_MAKE_GROUP_PUBLIC = False


Seafile Network Configurations (ccnet.conf):

Seafile 网络配置(ccnet.conf):

注意: 自从Seafile Server 5.0.0,所有的配置文件是移动了conf目录下:

你可以改变Seafile的网络选项通过修改 ccnet.conf file


[General]
# 该设置不再使用
USER_NAME=example

# 请不要改变这个 ID.
ID=eb812fd276432eff33bcdde7506f896eb4769da0

# 该设置不再使用
NAME=example

# Seahub (Seafile Web) 外部 URL,如果该值没有设对,会影响文件的上传下载。
# 注意: 外部 URL 意味着"如果你使用 Nginx, 请使用 Nginx 对外的 URL"
# 5.0 版开始,建议通过 Web 界面来修改,不要直接修改 ccnet.conf 中的值
SERVICE_URL=http://www.example.com:8000

Seafile.conf settings

注意: 自从Seafile  Server 5.0.0,所有的配置是移动到了conf 文件夹

存储配额设置 seafile.conf:

你可以设置一个默认的配置(例如2GB)对于所有的用户,完成这个,增加下面的行到seafile.conf文件:

[quota]
# default user quota in GB, integer only
default = 2

这个设置应用于所有用户,如果你要设置指定用户的配置  

默认历史记录设置

对所有的资料库设置一个默认的文件历史保留天数:
[history]
keep_days = days of history to keep

Seafile fileserver  配置(seafile.conf):

seafile fileserver  配置选项在[fileserver]章节

[fileserver]
# bind address for fileserver, default to 0.0.0.0
host = 0.0.0.0
# tcp port for fileserver
port = 8082


改变上传下载设置:

[fileserver]
# Set maximum upload file size to 200M.
max_upload_size=200

# Set maximum download directory size to 200M.
max_download_dir_size=200

在一个文件是通过web接口上传,或者通过客户端的云文件浏览器。

它需要被分成固定大小的blocks和存储到后端存储。

我们称此过程为"indexing"

默认,file server 使用1个线程来顺序的索引文件和逐个存储block.

当用户上传文件通过web接口(seahub),文件server将文件分成固定大小的blocks.

默认blocks 对于web上传那文件是1MB

[fileserver]
#Set block size to 2MB
fixed_block_size=2

当用户上传文件通过web接口,file server 分配一个令牌来认证upload 操作。

这个令牌是可用的 默认是1个小时

Seahub Settings:

注意:你可以修改配置通过web接口。

配置是保存在数据库表里(seahub-db/constance_config). 

原文地址:https://www.cnblogs.com/hzcya1995/p/13349773.html