运行环境
- windows server 2012 r2
相关组件
- DNS服务
- Nginx代理服务器(windows 1.13版本)
seafile下载安装
- 版本:6.07
seafile下载及相关组件
- seafile官网下载:http://seafile-downloads.oss-cn-shanghai.aliyuncs.com/seafile-server_6.0.7_win32.tar.gz
- python2.7 32位(只支持2.7的32位版本)
安装
- 先安装python2.7,安装过程需要勾选添加至环境变量选项;
- seafile解压后即可使用,官方安装教程:https://manual-cn.seafile.com/deploy_windows/download_and_setup_seafile_windows_server.html
- 安装完成后找到安装目录,运行seafile解压目录下的run.bat脚本,运行成功后系统任务栏图标会有相应图标;
验证安装
- 管理员用户,在seafile服务端任务栏图标右键并新建管理员即可;
- 打开浏览器,地址输入:http://127.0.0.1:8000
- 成功登陆即可
配置
DNS方式(双网卡内外网过程)
- DNS配置
- 添加正向查找区域,如
test.com
,默认全部下一步即可; - 新建主机(A或AAAA)(S)...
- 添加www名称,若希望使用二级域名方式访问则名称填写为你需要的二级域名值,如
//内网IP
名称:pan
完全限定的域名(FQDN):pan.test.com.
IP地址(P): 172.xxx.xxx.xxx
//外网IP
名称:pan
完全限定的域名(FQDN):pan.test.com.
IP地址(P): 192.xxx.xxx.xxx
主机添加完成后开始配置Nginx服务器以实现二级域名的地址转换;
- Nginx配置
...
http {
server_names_hash_bucket_size 64; # 需要添加该项
...
//该sever与原有监听80端口不冲突,因为server_name不一样,一个http下可添加相同端口不同server_name的字段
server {
listen 80;
server_name pan.text.com; # seafile需要设置的全局地址
# access_log logs/seafile/host.access.log main; #可选,需要记录日志的自行添加,请保证文件夹路径有效
location / {
proxy_set_header Host 127.0.0.1:8000;
proxy_pass http://127.0.0.1:8000;
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;
client_max_body_size 0;
}
location /seafhttp { # seafile服务的FILE_SERVER_ROOT设置项
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_set_header Host $host:$server_port;
proxy_connect_timeout 36000s;
proxy_read_timeout 36000s;
proxy_send_timeout 36000s;
send_timeout 36000s;
proxy_request_buffering off;
}
location /media {
rewrite ^/media(.*)$ /media$1 break;
root x:\xxx\seafile-server-6.0.7\seahub;
}
}
}
...
-
seafile配置
- 使用管理员账号登陆后台管理页面(右上角个人图标点击,选择系统管理)
- 左侧系统管理导航栏选择“设置”,需要修改两处位置
- SERVICE_URL
http://pan.test.com (修改后记得点击旁边的勾√以保存设置) - FILE_SERVER_ROOT //该项设置不对会导致文件上传失败
http://pan.test.com/seafhttp (修改后记得点击旁边的勾√以保存设置)
- SERVICE_URL
-
路由设置
-
为了使组内所有设备可以直接通过域名方式访问,需要在路由器中设置wlan或DHCP服务中的DNS服务器,设置为DNS服务所在计算机固定IP,保存后组内连接该路由下的所有设备都可通过域名方式进行访问和上传下载.
至此所有配置过程完成....
静态IP方式(固定IP)
- Nginx配置(可选)
# 配置示例
...
{
server{
listen 80;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
}
...