Integrate Collabora Online with Nextcloud on Ubuntu with Docker
This tutorial is going to show you how to install Collabora online server on Ubuntu with Docker and then integrate it with an existing Nextcloud server.
Collabora Online is a self-hostable and LibreOffice-based open-source online office suite. Its features include:
- Basic editing
- High fidelity, WYSIWYG rendering
- Supports DOC, DOCX, PPT, PPTX, XLS, XLSX, ODF document format
- Import and view Visio, Publisher and 100+ more
- Shared Editing
Collabora is a big contributor to the LibreOffice project. All of the Collabora Online codes will be eventually included in LibreOffice.
Note: If you are using Ubuntu 16.04 or Ubuntu 18.04, you can install Collabora Online from the official package repository, which is easier to manage than using Docker.
Prerequisites
It’s assumed that you have already set up a Nextcloud server, which can be on any Linux distribution. If you haven’t already done so, then you can check out the following easy-to-understand guides.
- How to Install Nextcloud on Ubuntu 18.04 with LEMP Stack
- How to Install Nextcloud on CentOS 8 with LEMP Stack
- How to set up Nextcloud on Arch Linux
The Collabora Online server and Nextcloud server can be on the same machine or on two different machines. This tutorial shows how to install Collabora online server on Ubuntu using a Docker image built by Collabora and Nextcloud. Then integrate it with an existing Nextcloud server.
Step 1: Install Docker on Ubuntu
If you want the latest Docker version, you can install Docker from Docker’s APT repository. For simplicity, this tutorial installs Docker from the default Ubuntu software repository.
sudo apt update sudo apt install docker.io
Once installed, the Docker daemon should be automatically started. You can check its status with:
systemctl status docker

Hint: If the above command doesn’t quit immediately, you can press the Q key to make it quit.
If it’s not running, then start the daemon with this command:
sudo systemctl start docker
And enable autostart at boot time:
sudo systemctl enable docker
Step 2: Install and Run Collabora Online Server with Docker
Execute the following command to pull the latest Collabora Online Development Edition image from Docker hub.
sudo docker pull collabora/code

Then run this docker container. Replace nextcloud\\.example\\.com with your nextcloud server domain, preseving the double slashes.
sudo docker run -t -d -p 127.0.0.1:9980:9980 -e 'domain=nextcloud\\.example\\.com' -e "extra_params=--o:ssl.enable=false --o:ssl.termination=true" --restart always collabora/code

Where:
-d: Detached mode makes the container run in the background.-t: Allocate a pseudo-TTY-p: Publish a container’s port to the host.-e: Set environment variables
The Collabora Online server will be listening on port 9980 of localhost (127.0.0.1) as can be shown by issuing the following command. (If your Ubuntu system doesn’t have the netstat command, you can install it with sudo apt install net-tools.)
sudo netstat -lnpt | grep docker

Step 3: Set up Reverse Proxy
Nextcloud server requires a TLS certificate on the Collabora Online, so we will need to create a virtual host, give the virtual host a domain name, set up a reverse proxy and install TLS certificate. We can use either Apache or Nginx to achieve this.
Apache
Install Apache web server with the following command:
sudo apt install apache2
Run the following command to create an Apache virtual host file for Collabora Online.
sudo nano /etc/apache2/sites-available/collabora.conf
Put the following text into the file. Replace the domain name with your actual domain name for Collabora Online. Don’t forget to create an A record for this sub-domain.
<VirtualHost *:80>
ServerName collabora.example.com
Options -Indexes
ErrorLog "/var/log/apache2/collabora_error"
# Encoded slashes need to be allowed
AllowEncodedSlashes NoDecode
# keep the host
ProxyPreserveHost On
# static html, js, images, etc. served from loolwsd
# loleaflet is the client part of Collabora Online
ProxyPass /loleaflet http://127.0.0.1:9980/loleaflet retry=0
ProxyPassReverse /loleaflet http://127.0.0.1:9980/loleaflet
# 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 "/lool/(.*)/ws$" ws://127.0.0.1:9980/lool/$1/ws nocanon
# Admin Console websocket
ProxyPass /lool/adminws ws://127.0.0.1:9980/lool/adminws
# Download as, Fullscreen presentation and Image upload operations
ProxyPass /lool http://127.0.0.1:9980/lool
ProxyPassReverse /lool http://127.0.0.1:9980/lool
</VirtualHost>
Save and close the file. To be able to proxy traffic using Apache, we need to enable some Apache modules.
sudo a2enmod proxy proxy_wstunnel proxy_http
Enable this virtual host with the following command:
sudo a2ensite collabora.conf
Then restart Apache.
sudo systemctl restart apache2
Nginx
Install Nginx on Ubuntu with the following command:
sudo apt install nginx
Create a virtual host file for Collabora Online.
sudo nano /etc/nginx/conf.d/collabora.conf
Put the following text into the file. Replace the domain name with your actual domain name for Collabora Online. Don’t forget to create an A record for this domain name.
server {
listen 80;
listen [::]:80;
server_name collabora.example.com;
# static files
location ^~ /loleaflet {
proxy_pass http://localhost:9980;
proxy_set_header Host $http_host;
}
# WOPI discovery URL
location ^~ /hosting/discovery {
proxy_pass http://localhost:9980;
proxy_set_header Host $http_host;
}
# Capabilities
location ^~ /hosting/capabilities {
proxy_pass http://localhost:9980;
proxy_set_header Host $http_host;
}
# main websocket
location ~ ^/lool/(.*)/ws$ {
proxy_pass http://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 http://localhost:9980;
proxy_set_header Host $http_host;
}
# Admin Console websocket
location ^~ /lool/adminws {
proxy_pass http://localhost:9980;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_read_timeout 36000s;
}
}
Save and close the file. Then test Nginx configurations.
sudo nginx -t
If the test is successful, reload Nginx server.
sudo systemctl reload nginx
Step 4: Obtain and Install TLS Certificate
Now let’s obtain a free TLS certificate from Let’s encrypt. Run the following commands to install Let’s Encrypt client (certbot) from the official certbot PPA.
sudo apt install software-properties-common sudo add-apt-repository ppa:certbot/certbot sudo apt update sudo apt install certbot
If you use Apache web server, then you also need to install the Certbot Apache plugin.
sudo apt install python3-certbot-apache
Then issue the following command to obtain a free TLS/SSL certificate.
sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d collabora.example.com
If you use Nginx web server, then you need to install the Certbot Nginx plugin.
sudo apt install python3-certbot-nginx
Then use the Nginx plugin to obtain and install the certificate by running the following command.
sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d collabora.example.com
You will see the following text indicating that you have successfully obtained a TLS certificate.

Final Step: Connect Nextcloud to Collabora Online
In your Nextcloud dashboard, go to the Apps page. Next, go to Office & Text section, find the Collabora Online app, click Download and Enable button.

After this apps is enabled, go to Nextcloud Settings page. Click Collabora Online tab on the left. Enter the domain name of your Collabora Online including https:// prefix, then click Apply button.

Now when you click the add button (+) in Nextcloud, you will be able to create Word, spreadsheet and presentation documents right from your Nextcloud server.


Wrapping Up
That’s it! I hope this tutorial helped you install, run Collabora Online on Ubuntu and integrate it with Nextcloud. As always, if you found this post useful, then subscribe to our free newsletter. You can also follow us on Twitter or like our Facebook page.















Thank you for creating this. Excellent instructions. 🙂
Thank you for you tutorial. When activating nginx, I encounter this message.
[email protected]***:~# sudo systemctl reload nginx
nginx.service is not active, cannot reload.
[email protected]***:~# sudo systemctl start nginx
Job for nginx.service failed because the control process exited with error code. See “systemctl status nginx.service” and “journalctl -xe” for details.
[email protected]***~# sudo systemctl reload nginx
nginx.service is not active, cannot reload.
[email protected]***:~# sudo systemctl status nginx.servic
● nginx.servic.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
Why is this showing even though I installed nginx?
Check out the log to see what caused this problem.
or
Thank you for your quick answer.
Here is what I get:
Nov 19 11:15:04 vps338912 kernel: [UFW BLOCK] IN=ens3 OUT= MAC=fa:16:3e:1f:31:98:fe:01:d6:d5:05:4e:08:00 SRC=85.214.201.198 DST=51.254.120.238 LEN=60 TOS=0x00 PREC=0x00 TTL=55 ID=21
2016/11/19 11:08:25 [emerg] 581#581: listen() to [::]:80, backlog 511 failed (98: Address already in use)
2016/11/19 11:08:25 [emerg] 581#581: still could not bind()
/var/log/nginx/error.log (END)
I added Nginx on ufw (sudo ufw allow in “Nginx Full”), yet it does not seem to help. How can I allow Nginx traffic?
This line tells you that port 80 is already is use by another process, so Nginx can’t listen on port 80. Have you installed Apache on your server? If that’s so, then you may want to use Apache rather than Nginx to set up the reverse proxy.
Thank you. Of course, you are right.