How to Integrate Collabora Online Office with NextCloud on a Vultr Cloud Server

Updated on July 6, 2022
How to Integrate Collabora Online Office with NextCloud on a Vultr Cloud Server header image

Introduction

Collabora 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.

Prerequisites

The prerequisites below are required prior to installation of Collabora Online Office with a new instance:

1. Install Collabora Online Office

  1. Pull the latest Collabora Online Office image from Docker Hub.

      $ sudo docker pull collabora/code:latest
  2. 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
  3. Verify that the container is running.

      $ sudo docker ps
  4. 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

2. Configure Nginx as a Reverse Proxy

  1. Create a new Nginx configuration file.

      $ sudo touch /etc/nginx/conf.d/collabora.conf
  2. Open and edit the file using a text editor.

      $ sudo nano /etc/nginx/conf.d/collabora.conf
  3. 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.

  4. Test Nginx for configuration errors.

      $ sudo nginx -t
  5. Restart Nginx to load changes.

      $ sudo systemctl restart nginx

3. Security

  1. Allow Nginx HTTP connections to the server.

      $ sudo ufw allow 80/tcp
  2. Allow HTTPS connections.

      $ sudo ufw allow 443/tcp
  3. Reload firewall rules to save changes.

      $ sudo ufw reload

4. Setup SSL

  1. Install the Certbot Let’s encrypt client.

      $ sudo apt install certbot python3-certbot-nginx -y
  2. 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
  3. Restart Nginx to load changes.

      $ sudo systemctl restart nginx
  4. Test HTTPS access by visiting your Collabora Office domain.

      https://collabora.example.com

    You should receive an OK signal.

5. Configure NextCloud

  1. 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
  2. Edit the NextCloud configuration file.

      $ sudo nano /var/www/html/config/config.php
  3. 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.

  4. Restart Nginx to load changes.

      $ sudo systemctl restart nginx
  5. Using a web browser of your choice, visit your Nextcloud domain.

      https://cloud.example.com
  6. Log in to NextCloud using credentials listed on your Vultr application information in the following format:

      User: user***
      Pass: *******

6. Integrate Collabora Online office with NextCloud

  1. On your NextCloud dashboard, click your user icon in the top right corner, and select Apps from the drop-down list.
  2. Navigate to the Office & Text apps section.
  3. Find the Collabora Online App, download and enable it.
  4. Access your user icon, and select Settings from the drop-down list.
  5. On the left navigation bar, click Collabora Online under the Administration section.
  6. Toggle Use your own server, enter your HTTPS Collabora Office server URL, and click Save. You should receive a server reachable alert.
  7. Scroll to Advanced settings and set your preferred default file type for documents, to work well with Microsoft Office products, use Office Open XML (OOXML). To automatically watermark documents, enable watermarking under Secure view settings.
  8. Navigate to Files.
  9. Click create new + to upload supported files, or choose between text, word document, spreadsheet, or presentation files to create.
  10. Collabora Online Office document types

More Information

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.