Log inSign up

ONLYOFFICE Docs as the editor for your Nextcloud

Install Docker, start the onlyoffice/documentserver container on 127.0.0.1:8080 with a JWT_SECRET you choose, and publish it as office.example.net through Nginx with a Let's Encrypt certificate. Then install the ONLYOFFICE connector app in Nextcloud and give it the server address and the same secret. Documents, spreadsheets and slides then open and co-edit inside the Nextcloud web interface.

Topic: Self-hosted apps · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13 · Updated 2026-12-03

What does ONLYOFFICE Docs need on the server?

ONLYOFFICE Docs (the Document Server) wants a 64-bit Ubuntu or Debian host with Docker, about 4 GB of memory and a separate hostname. The editor bundles its own PostgreSQL, RabbitMQ and Redis inside the container, so the footprint is larger than a typical web app even when idle.

  • Memory: 2 GB is the documented floor and only works with a swap file; 4 GB gives smooth co-editing for a small team. If Nextcloud runs on the same machine, plan for 6 to 8 GB.
  • Hostname: use something like office.example.net with A and AAAA records pointing at 198.51.100.24 and 2001:db8:4f2a::24. The guide on DNS records shows how.
  • Nextcloud: an existing instance, either from the Nextcloud guide or the Nextcloud app image.

Add swap first if your plan is small (see swap file), because the converter processes spike in memory when large files open.

How do you install Docker and start the Document Server?

Install Docker Engine from the official Docker repository, as described in Docker Engine, then run the container with persistent volumes and a long random JWT secret. Binding to the loopback address keeps port 8080 off the public interface.

docker --version
JWT=$(openssl rand -hex 32)
echo "$JWT" | sudo tee /root/onlyoffice-jwt.txt
sudo mkdir -p /srv/onlyoffice/{logs,data,lib,db,fonts}
sudo docker run -d --name onlyoffice --restart=always \
  -p 127.0.0.1:8080:80 \
  -e JWT_ENABLED=true -e JWT_SECRET="$JWT" \
  -v /srv/onlyoffice/logs:/var/log/onlyoffice \
  -v /srv/onlyoffice/data:/var/www/onlyoffice/Data \
  -v /srv/onlyoffice/lib:/var/lib/onlyoffice \
  -v /srv/onlyoffice/db:/var/lib/postgresql \
  -v /srv/onlyoffice/fonts:/usr/share/fonts/truetype/custom \
  onlyoffice/documentserver

The first start takes a minute or two while the internal services initialise. Watch progress with sudo docker logs -f onlyoffice and wait until the log calms down.

How do you check that the editor service is healthy?

Query the built-in health endpoint from the server itself: it answers true when the editor is ready to accept documents.

curl -s http://127.0.0.1:8080/healthcheck; echo
sudo docker ps --filter name=onlyoffice
sudo ss -tlnp | grep 8080

The ss output should show only 127.0.0.1:8080. If you see 0.0.0.0:8080, the port mapping lost its address prefix; remove the container with sudo docker rm -f onlyoffice and start it again with the exact command above. The volumes keep any data in place.

How do you publish ONLYOFFICE through Nginx with HTTPS?

Put Nginx in front, forward the WebSocket upgrade headers (co-editing depends on them) and tell the editor the original scheme so it builds HTTPS links. Install Nginx and Certbot, then create /etc/nginx/sites-available/onlyoffice:

sudo apt install -y nginx certbot python3-certbot-nginx
map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}
server {
    listen 80;
    listen [::]:80;
    server_name office.example.net;
    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 $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;
        proxy_read_timeout 300s;
    }
}
sudo ln -s /etc/nginx/sites-available/onlyoffice /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d office.example.net
curl -s https://office.example.net/healthcheck; echo

Certbot rewrites the server block to listen on 443 and adds the redirect from HTTP. More detail on renewals lives in the Certbot guide. Caddy users can replace all of this with a two-line site block, office.example.net and reverse_proxy 127.0.0.1:8080, because Caddy passes WebSockets and forwarded headers by default.

Which firewall ports should be open?

Only SSH, HTTP and HTTPS need to reach the server; the editor itself stays on loopback.

sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status verbose

Docker inserts its own rules for published ports, which is another reason to bind the container to 127.0.0.1 rather than rely on ufw to hide it. The firewall rules tutorial explains the nftables view of the same setup.

How do you connect ONLYOFFICE to Nextcloud?

Install the ONLYOFFICE connector app in Nextcloud, then set the editor address and the JWT secret. You can click through Administration settings, ONLYOFFICE in the web interface, or do it with occ on the Nextcloud host:

cd /var/www/nextcloud
sudo -u www-data php occ app:install onlyoffice
sudo -u www-data php occ config:app:set onlyoffice DocumentServerUrl --value="https://office.example.net/"
sudo -u www-data php occ config:app:set onlyoffice jwt_secret --value="PASTE-THE-SECRET-HERE"
sudo -u www-data php occ onlyoffice:documentserver --check

The last command contacts the editor and reports whether the connection and the token both work. Open Nextcloud in a browser, create a new document from the plus menu and type a line: if the editor loads and saves, the link is complete. Both sides must reach each other over HTTPS, so if Nextcloud lives on another server, make sure it can resolve office.example.net and that the editor can reach the Nextcloud hostname as well.

How do you add fonts and adjust settings?

Copy extra TrueType or OpenType fonts into /srv/onlyoffice/fonts and rebuild the font cache inside the container so they appear in the font list.

sudo cp ~/fonts/*.ttf /srv/onlyoffice/fonts/
sudo docker exec onlyoffice /usr/bin/documentserver-generate-allfonts.sh

Users must reload the editor tab afterwards. Configuration changes such as the maximum file size or autosave behaviour go into /etc/onlyoffice/documentserver/local.json inside the container. Edit it with sudo docker exec -it onlyoffice bash, then restart the services with supervisorctl restart all. Keep a note of every change, because a fresh container from a new image starts from defaults unless you mount the file.

How do you upgrade ONLYOFFICE Docs safely?

Pull the new image, put the server into a state where no document is open, then recreate the container with the same volumes and secret. Documents that are still being edited are held in the editor cache until they are saved back to Nextcloud, so give users a heads-up first.

sudo docker exec onlyoffice documentserver-prepare4shutdown.sh
sudo docker pull onlyoffice/documentserver
sudo docker rm -f onlyoffice
JWT=$(sudo cat /root/onlyoffice-jwt.txt)
# now repeat the docker run command from the install step
curl -s http://127.0.0.1:8080/healthcheck; echo

The prepare script flushes open documents to storage before the container stops. Combine this with the optional daily backups add-on, or a restic job on /srv/onlyoffice, so you can roll back if a major release changes behaviour.

What goes wrong most often?

  • "Download failed" in Nextcloud: the editor cannot fetch the file from Nextcloud. Test from the editor host with curl -I https://cloud.example.net; a DNS or certificate problem usually shows up there.
  • "Document security token is not correctly formed": the secrets differ. Compare /root/onlyoffice-jwt.txt with the value in the Nextcloud app settings.
  • Editor loads but co-editing freezes: the WebSocket headers are missing in the proxy, or a second proxy in front strips them.
  • Container restarts in a loop: check free -h; the bundled services need memory, and the kernel stops the largest process when it runs out.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A2-4editor alone for a small team2 vCPU, 4 GB RAM, 100 GB NVMe$14.40/mo$43.20 for 3 months
A4-8editor and Nextcloud on one server4 vCPU, 8 GB RAM, 180 GB NVMe$28.80/mo$86.40 for 3 months
F4-16busy co-editing with room to spare4 vCPU, 16 GB RAM, 384 GB NVMe$57.60/mo$57.60 for 1 month

Questions about ONLYOFFICE Docs with Nextcloud

Can ONLYOFFICE Docs and Nextcloud share one server?

Yes, as long as the server has enough memory for both and each uses its own hostname. Put both server blocks in the same Nginx and give the editor its own certificate.

Is the JWT secret required?

Current releases enable it by default, and it should stay on. Without it, anyone who knows the editor URL could ask it to open or convert files.

Does ONLYOFFICE need outgoing mail?

No. The Document Server sends no email. Notifications about shared documents come from Nextcloud, which you can point at an authenticated SMTP relay on port 587, as shown in the SMTP relay guide.

How many people can edit at once?

The free Community Edition limits simultaneous connections; check the current figure in the project documentation for your release. Memory and vCPU set the practical limit before that on small plans.

Can I use Caddy instead of Nginx?

Yes. A site block with reverse_proxy 127.0.0.1:8080 handles TLS, WebSockets and forwarded headers on its own. The Caddy HTTPS tutorial covers the install.

Where are the editor logs?

In /srv/onlyoffice/logs on the host, mainly the documentserver/docservice and converter folders, plus sudo docker logs onlyoffice for startup output.