ONLYOFFICE Docs (formerly Document Server) is an online office suite for collaborative editing of Word, Excel and PowerPoint files in the browser. It has strong Microsoft Office format compatibility and real-time co-editing. It doesn’t store files itself: it plugs into a document platform such as Nextcloud, Seafile, ownCloud, or your own app through its API.

Alternative: Collabora Online (LibreOffice-based).

Requirements

ONLYOFFICE Docs is heavier than most self-hosted apps:

  • At least 2 vCPU and 4 GB RAM, plus swap. 6–8 GB is comfortable for several simultaneous editors. See how much RAM a VPS needs.
  • Its own subdomain with HTTPS (for example office.example.com).
  • About 40 GB disk for the image, fonts, cache and logs.

It can run on the same server as Nextcloud if RAM allows. A separate VPS keeps editing load away from file sync.

Install with Docker

# /opt/onlyoffice/compose.yaml
services:
  onlyoffice:
    image: onlyoffice/documentserver:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:80"
    environment:
      JWT_ENABLED: "true"
      JWT_SECRET: "<long random secret>"
      JWT_HEADER: Authorization
    volumes:
      - ./logs:/var/log/onlyoffice
      - ./data:/var/www/onlyoffice/Data
      - ./lib:/var/lib/onlyoffice
      - ./fonts:/usr/share/fonts/truetype/custom
cd /opt/onlyoffice && docker compose up -d
docker compose logs -f     # first start takes a minute or two

JWT is essential. Without it, anyone who knows the URL can use your Document Server. Generate the secret with openssl rand -hex 32.

Nginx with HTTPS

server {
    server_name office.example.com;
    client_max_body_size 100M;
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    # listen 443 ssl; certbot --nginx -d office.example.com
}

X-Forwarded-Proto matters: without it, the editor loads assets over HTTP and the browser blocks them (mixed content). Open https://office.example.com/healthcheck, which should return true. See Nginx WebSocket proxy.

Connect to Nextcloud

  1. In Nextcloud: Apps → install ONLYOFFICE (the connector app).
  2. Administration settings → ONLYOFFICE:
    • Document Editing Service address: https://office.example.com/
    • Secret key: the same JWT_SECRET
  3. Save. Nextcloud checks the connection, and .docx, .xlsx and .pptx files then open in the editor.

Both servers must reach each other over HTTPS: Nextcloud calls the Document Server, and the Document Server downloads files from Nextcloud and sends saves back. If they’re on the same host behind Docker, make sure each can resolve the other’s public hostname. See Nextcloud install.

Editions and limits

  • Community Edition (free, AGPL): up to 20 simultaneous connections (open editor sessions). Fine for a family or small team.
  • Enterprise/Developer editions (paid) lift the limit and add support.

Fonts

Add your organisation’s fonts (.ttf/.otf) to the mounted fonts folder, then regenerate:

docker compose exec onlyoffice documentserver-generate-allfonts.sh

Without matching fonts, documents from Windows users may render with substitutes.

Troubleshooting

  • “Download failed” / “Error while downloading the document”: the Document Server can’t reach Nextcloud’s URL. Check DNS, certificates, and firewall rules between the two.
  • “Document security token is not correctly formed”: the JWT secrets don’t match.
  • Editor won’t load / mixed content: add the X-Forwarded-Proto header, and access only via HTTPS.
  • Slow or crashing: usually RAM. Check docker stats, and add swap. See swap.
  • Logs: ./logs/documentserver/.

Updates and backups

  • Update with docker compose pull && docker compose up -d. Close open documents first, so unsaved changes are written back to Nextcloud.
  • The Document Server keeps no permanent documents, so back up the compose file, the JWT secret and custom fonts. See updating self-hosted apps.

Quick reference

Item Value
Health check /healthcheck → true
Security JWT_ENABLED=true, JWT_SECRET
Community limit 20 simultaneous connections
Minimum size 2 vCPU / 4 GB RAM + swap
Fonts mount + documentserver-generate-allfonts.sh

Related: Stirling-PDF and Paperless-ngx.

  • Self-Hosting
  • Docker
  • Nextcloud