How to Integrate Collabora Online with Nextcloud

This tutorial assumes you’re running Ubuntu 20.04 and Nextcloud 23 (or greater). It also assumes you know how to create A name records and can create and enable virtual host files.

Install from official repository

echo 'deb https://www.collaboraoffice.com/repos/CollaboraOnline/CODE-ubuntu2004 ./' | sudo tee /etc/apt/sources.list.d/collabora.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0C54D189F4BA284D
sudo apt install -y apt-transport-https ca-certificates
sudo apt update -y
sudo apt install -y coolwsd code-brand

Configure coolwsd

systemctl status coolwsd

Now verify coolwsd is running

sudo journalctl -eu coolwsd

It’s probably not running. We have more to do.

sudo coolconfig set ssl.enable false
sudo coolconfig set ssl.termination true
sudo coolconfig set storage.wopi.host nextcloud.example.tld
sudo coolconfig set-admin-password
sudo systemctl restart coolwsd
systemctl status coolwsd

Setup a reverse proxy

The server is now accessable from http://127.0.0.1:9980 but using this probably won’t work. Collabora Online requires your Nextcloud instance and Collabora Online server using the same protocol. You’re likely using https for Nextcloud. A reverse proxy is the easiest solution.

I’m going to assume you know how to setup an A name record and know how to create and enable a virtual hosts file. Your file should look like this:

<VirtualHost *:80>
        ServerName code.example.tld
        AllowEncodedSlashes NoDecode
        ProxyPreserveHost On

# static html, js, images, etc. served from coolwsd
# browser is the client part of Collabora Online
        ProxyPass           /browser http://127.0.0.1:9980/browser retry=0
        ProxyPassReverse    /browser http://127.0.0.1:9980/browser

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

# Capabilities
        ProxyPass           /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities retry=0
        ProxyPassReverse    /hosting/capabilities http://127.0.0.1:9980/hosting/capabilities

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

# Admin Console websocket
        ProxyPass           /cool/adminws ws://127.0.0.1:9980/cool/adminws

# Download as, Fullscreen presentation and Image upload operations
        ProxyPass           /cool http://127.0.0.1:9980/cool
        ProxyPassReverse    /cool http://127.0.0.1:9980/cool
# Compatibility with integrations that use the /lool/convert-to endpoint
        ProxyPass           /lool http://127.0.0.1:9980/cool
        ProxyPassReverse    /lool http://127.0.0.1:9980/cool
</VirtualHost>

Now use Let’s Encrypt to generate a certificate so https can be used.

sudo certbot --apache

Install Collabora Online on Nextcloud and configure it in settings.

  • Select Use your own server

  • Enter your server name (Example: https://code.example.tld)

  • Uncheck Disable certificate verification (insecure)