安装ONLYOFFICE Docs Community Edition并与next cloud集成

ONLYOFFICE Docs是onlyoffice的server端,可以通过onlyoffice api和WOPI两种方式与客户端连接。
下面是onlyoffice docs的安装:

  1. 安装onlyoffice docs
sudo add-apt-repository ppa:5-sergey/nginx-quic
sudo apt update
sudo apt-get install postgresql
sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH PASSWORD 'onlyoffice';"
sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice OWNER onlyoffice;"
sudo apt-get install rabbitmq-server
sudo apt-get install nginx-extras
mkdir -p -m 700 ~/.gnupg
curl -fsSL https://download.onlyoffice.com/GPG-KEY-ONLYOFFICE | gpg --no-default-keyring --keyring gnupg-ring:/tmp/onlyoffice.gpg --import
chmod 644 /tmp/onlyoffice.gpg
sudo chown root:root /tmp/onlyoffice.gpg
sudo mv /tmp/onlyoffice.gpg /usr/share/keyrings/onlyoffice.gpg
echo "deb [signed-by=/usr/share/keyrings/onlyoffice.gpg] https://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
sudo apt-get update
sudo apt-get install ttf-mscorefonts-installer
sudo apt-get install onlyoffice-documentserver

参考:
https://helpcenter.onlyoffice.com/installation/docs-community-install-ubuntu.aspx?_ga=2.121380878.782359554.1594636128-1157782750.1587541027
https://github.com/ONLYOFFICE/onlyoffice-nextcloud

  1. 申请证书

我这里是用acme.sh申请的,过程略

  1. 配置nginx

编辑/etc/nginx/conf.d/ds.conf

include /etc/nginx/includes/http-common.conf;
server {
  listen 0.0.0.0:80;
  listen [::]:80 default_server;
  server_tokens on;

  set secure_link_secret 123456;
  include /etc/nginx/includes/ds-*.conf;
}
server {
    listen 443 quic reuseport;
    listen       443 ssl;
    listen [::]:443 quic reuseport;
    listen       [::]:443 ssl;
    http2 on;
    http3 on;
    quic_retry on;


    # Use Mozilla's guidelines for SSL/TLS settings
    # https://mozilla.github.io/server-side-tls/ssl-config-generator/
    ssl_certificate     /opt/certs/hetao.me/fullchain.cer;
    ssl_certificate_key /opt/certs/hetao.me/hetao.me.key;
    ssl_protocols TLSv1.3;

    # Prevent nginx HTTP Server Detection
    server_tokens on;

    # HSTS settings
    # WARNING: Only add the preload option once you read about
    # the consequences in https://hstspreload.org/. This option
    # will add the domain to a hardcoded list that is shipped
    # in all major browsers and getting removed from this list
    # could take several months.
    add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload" always;
    add_header Alt-Svc 'h3=":443"; ma=86400';
    setsecure_link_secret 123456;
    include /etc/nginx/includes/ds-*.conf;
}
  1. 配置域名

配置onlyoffice.hetao.me指向onlyoffice docs服务器
过程略
5. nextcloud中安装onlyoffice扩展

新版本nextcloud似乎不能在线安装onlyoffice扩展了,所以用下面的方法离线安装。
在 https://apps.nextcloud.com/apps/onlyoffice 这个页面上下载扩展的tar包,解压到/var/www/nextcloud/apps文件夹中,然后在nextcloud的app管理页面启用onlyoffice扩展。

  1. 配置nextcloud


其中秘钥就是JWT私钥,可以在/etc/onlyoffice/documentserver/local.json文件中配置。
inbox,outbox,session三个私钥设置一样并且与nextcloud中的配置一致。

  1. 使用效果

参考:

Setting up and configuring native CODE packages on Linux

发表回复