安装Coloud支持e在线编辑ine让N

NextCloud可通过插件实现在线编辑Office文档,不过前提是需要依赖于Collabora Online服务,记录一下操作过程。

-1

部署Collabora Online服务

Collabora Online提供多种平台和多种安装方式,这篇文章使用Linux Docker方式来一键部署。

CentOS安装Docker

#安装dockeryum -y install docker#运行dockerservice docker start#设置docker开机启动systemctl enable docker

Docker部署Collabora Online

#部署Collabora Onlinedocker pull collabora/code#运行Collabora Onlinedocker run -t -d -p 127.0.0.1:9980:9980 -e "domain=<your-dot-escaped-domain>"         -e "username=admin" -e "password=S3cRet" --restart always --cap-add MKNOD collabora/code

注意上面的<your-dot-escaped-domain>指的是WOPI主机,也就是您NextCloud所使用的域名,多个域名可以用|进行分隔,您需要在命令行中使用双反斜杠,因为shell会转义第一个,而domain参数会使用正则表达式。

比如您NextCloud域名是https://cloud.ttt.sh/,那么输入的命令应该是如下:

docker run -t -d -p 127.0.0.1:9980:9980 -e "domain=cloud.ttt.sh"         -e "username=admin" -e "password=S3cRet" --restart always --cap-add MKNOD collabora/code
  • username:后面是用户名
  • password:后面是密码

账号、密码请根据自己需要进行调整,如果不报错应该是安装成功了,输入命令netstat -apn|grep '9980'看到如下截图说明Collabora Online已经正常运行。

-2

Nginx反向代理Collabora Online

上一个步骤Collabora Online虽然已经安装成功,但是只能内网访问,假如您需要公网方式来提供服务,可以使用Nginx反向代理。以下是xiaoz的Nginx反向代理配置,供参考:

server    {     listen 443 ssl http2;    #listen [::]:443 ssl http2;    # certs sent to the client in SERVER HELLO are concatenated in ssl_certificate    ssl_certificate /data/ssl/ttt.sh.crt;    ssl_certificate_key /data/ssl/ttt.sh.key;    ssl_session_timeout 1d;    ssl_session_cache shared:SSL:50m;    ssl_session_tickets off;    # intermediate configuration. tweak to your needs.    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;    ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';    ssl_prefer_server_ciphers on;    # OCSP Stapling ---    # fetch OCSP records from URL in ssl_certificate and cache them    ssl_stapling on;    ssl_stapling_verify on;    server_name     office.ttt.sh;    # 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;    }}server{     listen 80;    server_name office.ttt.sh;    rewrite ^(.*) https://office.ttt.sh$1 permanent;}

然后访问https://<CODE-domain>/loleaflet/dist/admin/admin.html可以进入Collabora Online控制台,至此Collabora Online服务已经部署完毕。

snipaste_20180814_182828-3

NextCloud设置

在NextCloud后台 - 应用 - 找到Collabora Online插件并启用。然后在设置 - 在线协助,填写Collabora Online的域名,如下截图。

-4

最后打开NextCloud中的Office文档可以在线编辑了,如下截图。

-4

总结

Collabora Online不仅可以为NextCloud为提供在线文档编辑,也可以让Seafile 支持Office预览。值得一提的是Collabora Online比较耗费内存,尤其是多人同时编辑文档的情况下,因此部署Collabora Online建议4G内存以上。

此文部分内容参考了:Collabora Online Development Edition (CODE)

上一篇:蒸馒头发面时,不要只会放酵母,牢记这6个窍门,馒头雪白又膨松
下一篇:炖鸡汤时,不管用什么鸡都别焯水,牢记3个技巧,金黄油亮香味足