Nextcloud: Install Collabora Online

This installation guide is tested with Nextcloud 11, 12 and 13 on Ubuntu 16.04.

See also installation instructions for Nextcloud 15 on Ubuntu 18.04.

Prerequisites

Setup Subdomain

on your nameserver, for example office.domain.xx. The subdomain is essential for running a Collabora online server.

Install SSL Certificate

Install the Collabora Online Server

docker pull collabora/code
docker run -t -d -p 127.0.0.1:9980:9980 -e 'domain=cloud\\.domain\\.xx\|nc\\.domain2\\.xx' -e 'username=admin' -e 'password=Secret.Password' --restart always --cap-add MKNOD collabora/code

Adjust domains, username and password. If you have more than one vHost with Collabora, be sure to add them in the docker start command. Otherwise you’ll get an error message:

Unauthorised WOPI host

Add Collabora to services

vi /etc/services
collabora     9980/tcp     # Nextcloud
netstat -pat | grep collabora
tcp   0    0    localhost:collabora     *:*    LISTEN     9756/docker-proxy

Install the Apache Reverse Proxy

a2enmod proxy
a2enmod proxy_wstunnel
a2enmod proxy_http
a2enmod ssl

Configure a subdomain to proxy the traffic

<VirtualHost *:80>
  ServerName office.domain.xx
  ServerAdmin webmaster@domain.xx
</VirtualHost>

<IfModule mod_ssl.c>
  <VirtualHost 10.20.30.40:443>
    ServerName office.domain.xx:443
    ServerAdmin webmaster@domain.xx

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/office.domain.xx/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/office.domain.xx/privkey.pem

    SSLProtocol all -SSLv2 -SSLv3
    SSLCipherSuite 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
    SSLHonorCipherOrder on

    # Encoded slashes need to be allowed
    AllowEncodedSlashes NoDecode

    # Container uses a unique non-signed certificate
    SSLProxyEngine On
    SSLProxyVerify None
    SSLProxyCheckPeerCN Off
    SSLProxyCheckPeerName Off

    # https://wiki.ubuntuusers.de/Apache/mod_proxy_html/
    ProxyRequests Off

    # keep the host
    ProxyPreserveHost On

    # static html, js, images, etc. served from loolwsd
    # loleaflet is the client part of LibreOffice Online
    ProxyPass /loleaflet https://127.0.0.1:9980/loleaflet retry=0
    ProxyPassReverse /loleaflet https://127.0.0.1:9980/loleaflet

    # WOPI discovery URL
    ProxyPass /hosting/discovery https://127.0.0.1:9980/hosting/discovery retry=0
    ProxyPassReverse /hosting/discovery https://127.0.0.1:9980/hosting/discovery

    # Main websocket
    ProxyPassMatch "/lool/(.*)/ws$" wss://127.0.0.1:9980/lool/$1/ws nocanon

    # Admin Console websocket
    ProxyPass /lool/adminws wss://127.0.0.1:9980/lool/adminws

    # Download as, Fullscreen presentation and Image upload operations
    ProxyPass /lool https://127.0.0.1:9980/lool
    ProxyPassReverse /lool https://127.0.0.1:9980/lool
  </VirtualHost>
</IfModule>

Adjust domain and IP address.

Restart Apache

service apache2 restart

WOPI discovery URL

https://office.domain.xx/hosting/discovery 

Credentials are of the docker run command as specified above

... -e 'username=admin' -e 'password=Secret.Password' ...

Install Collabora Online app

of the Nextcloud app store: apps.nextcloud.com/apps/richdocuments

Configure the app

Go to Admin Settings | Collabora Online and enter the subdomain

If the Collabora Online Server is not running or not configured in the Nextcloud administration, you’ll get an intern server error:

Also check if SSL certificates are setup correct.

Congratulations!

Your have successfully installed and configured Collabora Online Office.