Author: Christian Kintu
Last Updated: Wed, Jul 6, 2022Collabora Online Office is a self-hosted LibreOffice-based online office solution with support for common document formats: ods, doc, docx, pptx, xlxs, among others. This article provides a step by step outile for integration and use of Collabora Online Office with NextCloud on a Vultr Cloud server.
The prerequisites below are required prior to installation of Collabora Online Office with a new instance:
Pull the latest Collabora Online Office image from Docker Hub.
$ sudo docker pull collabora/code:latest
Deploy a Collabora Office container listening on your preferred port, the value of 9980
is being used as an example. Replace the cloud.example.com
sub-domain with your NextCloud sub-domain.
$ sudo docker run -t -d -p 9980:9980 --name collaboraoffice -e 'domain=cloud.example.com' -e "extra_params=--o:ssl.enable=false --o:ssl.termination=true"--restart always collabora/code
Verify that the container is running.
$ sudo docker ps
Output for container verification.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4d2244f6857e collabora/code "/start-collabora-onâ¦" 38 seconds ago Up 37 seconds 0.0.0.0:9980->9980/tcp, :::9980->9980/tcp collaboraoffice
Create a new Nginx configuration file.
$ sudo touch /etc/nginx/conf.d/collabora.conf
Open and edit the file using a text editor.
$ sudo nano /etc/nginx/conf.d/collabora.conf
Add the following contents to the text editor file.
server {
listen 80;
listen [::]:80;
server_name collabora.example.com;
error_log /var/log/nginx/collaboraoffice.error;
access_log /var/log/nginx/collaboraoffice.access;
# Connect to Collabora Office
location ~ /{
proxy_pass http://localhost:9980;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
#Connect the 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;
}
# 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;
}
# Handle static files
location ^~ /loleaflet {
proxy_pass http://localhost:9980;
proxy_set_header Host $http_host;
}
location ~ ^/lool {
proxy_pass http://localhost:9980;
proxy_set_header Host $http_host;
}
# WOPI discovery
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;
}
}
Ensure local host and server name reflect Install Collabora Office Online selections, save file.
Test Nginx for configuration errors.
$ sudo nginx -t
Restart Nginx to load changes.
$ sudo systemctl restart nginx
Allow Nginx HTTP connections to the server.
$ sudo ufw allow 80/tcp
Allow HTTPS connections.
$ sudo ufw allow 443/tcp
Reload firewall rules to save changes.
$ sudo ufw reload
Install the Certbot Letâs encrypt client.
$ sudo apt install certbot python3-certbot-nginx -y
Request a free Letâs Encrypt certificate. Replace collabora.example.com
with your domain.
$ sudo certbot -d collabora.example.com -m admin@example.com --agree-tos
Restart Nginx to load changes.
$ sudo systemctl restart nginx
Test HTTPS access by visiting your Collabora Office domain.
https://collabora.example.com
You should receive an OK signal.
Generate a Letâs Encrypt SSL certificate to link your subdomain with the NextCloud instance.
$ sudo certbot -d cloud.example.com -m admin@example.com --agree-tos
Edit the NextCloud configuration file.
$ sudo nano /var/www/html/config/config.php
Replace your server IP address with your domain in the trusted_domains
array. Your edited section should look like the one below.
'trusted_domains' =>
array (
0 => 'cloud.example.com',
),
Save the file.
Restart Nginx to load changes.
$ sudo systemctl restart nginx
Using a web browser of your choice, visit your Nextcloud domain.
https://cloud.example.com
Log in to NextCloud using credentials listed on your Vultr application information in the following format:
User: user***
Pass: *******
HTTPS
Collabora Office server URL, and click Save. You should receive a server reachable alert.You have successfully integrated Collabora Online Office with NextCloud running on a Vultr Cloud Server. For more information and configuration options, please visit the following articles.