部署Collabora Online实现文档编辑和预览

2020-04-29

配置Collabora Online实现Nextcloud文档共享预览编辑

还有onlyoffice 这种方式,不过这种是付费的。

基于Docker部署

前提先安装docker

  1. docker部署Collabora Online(刚刚启动cpu会有短时间上升)

    1
    2
    3
    docker pull collabora/code
    docker run -t -d -p 127.0.0.1:9980:9980 -e "domain=cloud.tangbull.xyz" \
    -e "username=admin" -e "password=3baed01449220c8a" --restart always --cap-add MKNOD collabora/code
  1. 配置Nginx反向代理

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    server {
    listen 10443 ssl;
    server_name cloud.tangbull.xyz;

    ssl_certificate /etc/httpd/ssl/tangbull.xyz.crt;
    ssl_certificate_key /etc/httpd/ssl/tangbull.xyz.key;
    error_log /var/log/nginx/collabora_error.log warn;
    access_log /var/log/nginx/collabora_access.log;

    # static files
    location ^~ /loleaflet {
    proxy_pass https://localhost:9980;
    proxy_set_header Host $http_host;
    }

    # WOPI discovery URL
    location ^~ /hosting/discovery {
    proxy_pass https://localhost:9980;
    proxy_set_header Host $http_host;
    }

    # main websocket
    location ~ ^/lool/(.*)/ws$ {
    proxy_pass https://localhost:9980;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $http_host;
    proxy_read_timeout 36000s;
    }

    # download, presentation and image upload
    location ~ ^/lool {
    proxy_pass https://localhost:9980;
    proxy_set_header Host $http_host;
    }

    # Admin Console websocket
    location ^~ /lool/adminws {
    proxy_pass https://localhost:9980;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $http_host;
    proxy_read_timeout 36000s;
    }
    }
    1
    2
    nginx -t
    nginx -s reload
  1. 测试collabora

    1
    访问https://cloud.tangbull.xyz:10443/loleaflet/dist/admin/admin.html

  2. 与Nextcloud连接

    安装插件

  3. 测试使用

    测试一下打开excel