我这里使用Centos7 安装的seafile

环境准备,如果有以下环境可以跳过

一、 首先安装Nginx ,准备代理环境

使用epel的方式进行安装

1. 先安装epel

  • 01
sudo yum install yum-utils

2. 安装完成后,查看安装的epel包即可

  • 01
yum install epel-release

3 开始安装nginx

使用yum进行安装:

  • 01
yum install nginx

4 启动并进行测试

查看nginx版本

  • 01
nginx -v

设置开机自启动

  • 01
systemctl enable nginx

启动nginx

  • 01
systemctl start nginx

二、安装docker,准备容器运行时

1. 安装所需的软件包

  • 01
yum install -y yum-utils device-mapper-persistent-data lvm2

2. 设置yum源(国内仓库稳定)

  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08
#这是官方yum源 yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo #由于网络问题非常建议使用国内源 #yum-config-manager \ # --add-repo \ # https://mirrors.ustc.edu.cn/docker-ce/linux/centos/docker-ce.repo

3. 安装docker-ce(社区版)

  • 01
yum install docker-ce

4. 测试docker是否安装成功

  • 01
docker -v

5. 启动docker

  • 01
systemctl start docker

6. docker查看状态、启动、停止

  • 01
systemctl status|start|stop docker

7. docker 开机启动

  • 01
systemctl enable docker

seafile 和 onlyoffice 安装

docker 运行 seafile 容器

参数解析:
SEAFILE_SERVER_HOSTNAME:服务器域名或者IP
SEAFILE_ADMIN_EMAIL:管理员账号
SEAFILE_ADMIN_PASSWORD:管理员密码
-v /software/seafile/data:seafile容器挂载目录
-p 81:80:端口映射
–restart=always 开启容器自启动
以上参数可根据需要修改

  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08
docker run -d --name seafile \ -e SEAFILE_SERVER_HOSTNAME=13.124.142.26 \ -e SEAFILE_ADMIN_EMAIL=me@example.com \ -e SEAFILE_ADMIN_PASSWORD=qwert,888 \ -v /software/seafile/data:/shared \ -p 81:80 \ --restart=always \ seafileltd/seafile:latest

docker 运行 onlyoffice 容器

参数解析:
JWT_ENABLED:是否开启JWT认证
-v 容器挂载目录
-p 端口映射
–restart=always 开启容器自启动
以上参数可根据需要修改

  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08
  • 09
docker run -d --name onlyoffice \ -p 8080:80 \ -e JWT_ENABLED=false \ -v /software/onlyoffice/DocumentServer/logs:/var/log/onlyoffice \ -v /software/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data \ -v /software/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice \ -v /software/onlyoffice/DocumentServer/db:/var/lib/postgresql \ --restart=always \ onlyoffice/documentserver:7.1.1

说明

防火墙开放 这里注意需要打开防火墙的 8080 和 80 端口 ,为什么不打开81,因为81只是过渡的端口。

代理配置和seafile集成onlyoffice

1. nginx 配置代理80,代理seafile ,后期添加ssl认证

  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08
  • 09
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
server { listen 80; server_name _; #charset koi8-r; #access_log logs/host.access.log main; client_max_body_size 2048m; error_page 497 307 =301 @back; location @back { rewrite ^(.*)$ https://$host:$server_port$1 permanent; } location / { proxy_set_header Host $host; proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_pass http://127.0.0.1:81; } }

2. seafile集成onlyoffice

vim {seafile-data}/seafile/conf/seahub_settings.py
{seafile-data} 是seafile的挂载路径
添加以下配置信息到 {seafile-data}/seafile/conf/seahub_settings.py

  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
# Enable Only Office ENABLE_ONLYOFFICE = True VERIFY_ONLYOFFICE_CERTIFICATE = False # ONLYOFFICE_APIJS_URL = 'http{s}://{your OnlyOffice server's domain or IP}/web-apps/apps/api/documents/api.js' ONLYOFFICE_APIJS_URL = 'https://你的域名和端口/web-apps/apps/api/documents/api.js' ONLYOFFICE_FILE_EXTENSION = ('doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'fodt', 'odp', 'fodp', 'ods', 'fods') ONLYOFFICE_EDIT_FILE_EXTENSION = ('docx', 'pptx', 'xlsx')

重启seafile

  • 01
docker restart seafile

访问seafile

http://{your seafile server's domain or IP}