keepcalculator

06 Numbers and Powers

Self-Host Nextcloud Office for Document Editing

Card No. 06·41355 · Updated · Standard formula, shown below

This guide walks you through setting up Nextcloud Office (Collabora Online) on your own server, so you can edit documents, spreadsheets, and presentations directly in your Nextcloud web interface. You’ll need a working Nextcloud instance, a domain name pointing to your server, and basic comfort with the command line. By the end, you’ll have a fully functional office suite that keeps your data on your own hardware.

What You’ll Need

  • A server running Linux (Ubuntu 22.04/24.04 or Debian 11/12 recommended) with at least 4 GB RAM and 2 CPU cores.
  • A domain name (or subdomain) that resolves to your server’s public IP. A wildcard DNS record is not required but helpful.
  • Nextcloud already installed and accessible via HTTPS (using Apache or Nginx).
  • Root or sudo access to the server.
  • Ports 80 and 443 open in your firewall.

Step-by-Step

  1. Install Docker and Docker Compose (if not already installed). On Ubuntu/Debian:
    sudo apt update
    sudo apt install docker.io docker-compose-plugin
    sudo systemctl enable --now docker
  2. Create a directory for Collabora:
    sudo mkdir -p /opt/collabora
  3. Create a Docker Compose file at /opt/collabora/docker-compose.yml with the following content:
    services:
      collabora:
        image: collabora/code:latest
        container_name: collabora
        restart: unless-stopped
        ports:
          - "127.0.0.1:9980:9980"
        environment:
          - domain=nextcloud.example.com
          - username=admin
          - password=your_strong_password
          - extra_params=--o:ssl.enable=false --o:server.enable_owner=false
        volumes:
          - collabora_data:/opt/collabora/data
    volumes:
      collabora_data:

    Replace nextcloud.example.com with your Nextcloud domain and set a strong password. Note: the domain variable should be the domain where Nextcloud is hosted, not the Collabora subdomain.

  4. Start Collabora:
    cd /opt/collabora
    sudo docker compose up -d

    Check it’s running with sudo docker compose ps.

  5. Configure a reverse proxy for Collabora. Since Collabora listens on localhost:9980, you need to expose it via HTTPS. If you use Nginx, add a server block for collabora.example.com:
    server {
        listen 443 ssl;
        server_name collabora.example.com;
    
        ssl_certificate /etc/letsencrypt/live/collabora.example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/collabora.example.com/privkey.pem;
    
        location / {
            proxy_pass http://127.0.0.1:9980;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_read_timeout 3600s;
        }
    }

    For Apache, use a similar VirtualHost with ProxyPass and ProxyPassReverse.

  6. Obtain an SSL certificate for your Collabora subdomain using Certbot:
    sudo apt install certbot python3-certbot-nginx
    sudo certbot --nginx -d collabora.example.com

    For Apache, use python3-certbot-apache.

  7. Enable the Nextcloud Office app in Nextcloud. Go to Apps → Office and install Nextcloud Office (or Collabora Online).
  8. Configure the app: In Nextcloud, go to Settings → Office. Enter the URL of your Collabora server: https://collabora.example.com. Do not include a trailing slash.
  9. Test the connection: Click the “Test� button in the Office settings. If it shows a green checkmark, you’re good. If not, review the troubleshooting section below.
  10. Restart both services to apply changes:
    sudo systemctl restart nginx
    sudo docker restart collabora
  11. Verify editing: Create a new document in Nextcloud (or open an existing one). It should open in the Collabora editor instead of downloading.

Common Mistakes

  • Wrong domain in the Collabora container: The domain environment variable must be the exact domain of your Nextcloud instance, including subdomain if any. If it’s wrong, Collabora will refuse connections.
  • Forgetting WebSocket support: Collabora uses WebSockets. If your reverse proxy doesn’t forward the Upgrade and Connection headers, the editor will fail to load.
  • Using HTTP instead of HTTPS: Both Nextcloud and Collabora must be served over HTTPS. Mixed content will block the editor.
  • Port 9980 exposed publicly: You should only bind Collabora to localhost (as shown) and use a reverse proxy. Exposing 9980 directly can cause security issues and is often blocked by browsers.
  • Not restarting after config changes: After editing the docker-compose file or the reverse proxy config, you must restart the services for changes to take effect.

Tips

  • Use a dedicated subdomain for Collabora (e.g., collabora.example.com) to avoid cookie conflicts with your main domain.
  • For better performance, consider using a wildcard SSL certificate if you plan to host multiple subdomains.
  • Keep your Collabora container updated: sudo docker compose pull and sudo docker compose up -d.
  • If you have a firewall, ensure only ports 80 and 443 are open from the outside; 9980 should be closed.
  • Set a strong password for the Collabora admin user (the one in the docker-compose file) to prevent unauthorized access.

Troubleshooting

  • Editor doesn’t load, shows a blank page: Check the browser console for WebSocket errors. Make sure your reverse proxy forwards the Upgrade and Connection headers. Also verify that proxy_read_timeout is set to a high value (3600s).
  • “Server is not reachable� in Nextcloud Office settings: This usually means the URL is wrong or Collabora is not listening. Check sudo docker logs collabora for errors. Also try curl https://collabora.example.com/hosting/discovery from the server; it should return an XML response.
  • Collabora container keeps restarting: Run sudo docker logs collabora to see the error. Common causes: wrong domain, insufficient memory, or the password is too short.
  • Document opens read-only: Ensure the Nextcloud user has write permissions on the file. Also check that the Collabora app is enabled for the user group in Nextcloud settings.
  • SSL certificate errors: If you get certificate warnings, make sure the certificate is valid for the Collabora subdomain and that it’s installed correctly in the reverse proxy.
  • Editing works but changes don’t save: Check that the Nextcloud server can reach Collabora. If you have a firewall, allow outbound connections from Nextcloud to Collabora on port 443.

Frequently Asked Questions

Q: Can I use Collabora without Docker?
A: Yes, you can install Collabora Online Development Edition (CODE) directly on your server, but Docker is the officially recommended method because it simplifies updates and dependencies.

Q: What are the minimum hardware requirements?
A: For light use (a few users), 4 GB RAM and 2 CPU cores are sufficient. For heavy use, scale up accordingly. Collabora is memory-hungry when multiple documents are open.

Q: Can I use a free SSL certificate from Let’s Encrypt?
A: Absolutely. Let’s Encrypt certificates work perfectly with Collabora and Nextcloud. Use Certbot to automate renewal.

Q: Does Nextcloud Office support all file types?
A: It supports ODF (ODT, ODS, ODP), DOCX, XLSX, PPTX, and many other formats. It can also edit PDFs in a limited way.

Q: How do I update Collabora?
A: Simply run sudo docker compose pull and sudo docker compose up -d in the /opt/collabora directory. The container will be replaced with the latest image.

Q: Is it possible to run Collabora on the same domain as Nextcloud?
A: It’s not recommended because of cookie and routing conflicts. A subdomain is the cleanest approach.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →