Install ONLYOFFICE for Nextcloud

This tutorial will demonstrate how to install ONLYOFFICE on a Debian 10 server running Nextcloud. Watch the video version here.

Prerequisites: You will need a server running Debian 10 (visit or if you don't have one.) You will also need a domain name (visit if you don't have one.) It's expected that you already have Nextcloud 17 set up (use this tutorial if you haven't set Nextcloud up yet.)

Example parameters: In this example, the domain name for our Nextcloud server will be "" and the domain name for our ONLYOFFICE server will be "". All passwords will be set to "P@ssw0rd".

Step 1: Make sure your server is entirely up-to-date:

sudo apt update
sudo apt full-upgrade

Step 2: Install GnuPG and import the ONLYOFFICE key:

apt install gnupg
apt-key adv --keyserver hkp:// --recv-keys CB2DE8E5

Step 3: Add the ONLYOFFICE repository to the system:

echo "deb squeeze main" | tee /etc/apt/sources.list.d/onlyoffice.list
apt update

Step 4: Set the non-standard port for ONLYOFFICE in the debconf databse:

echo onlyoffice-documentserver onlyoffice/ds-port select 81 | debconf-set-selections

Step 5: Install PostgreSQL and set up the ONLYOFFICE user & database:

apt install postgresql
sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH password 'P@ssw0rd';"
sudo -i -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"

Step 6: Install Redis and RabbitMQ:

apt install redis rabbitmq-server

Step 7: Install the ONLYOFFICE package:

apt install onlyoffice-documentserver

When asked, enter the PostgreSQL password you specified in the "CREATE USER" command earlier.

Step 8: When apt errors out of the installation, edit the NGINX default site configuration file:

nano /etc/nginx/sites-enabled/default

Change all instances of the number "80" to "81", then tell dpkg to try configuring the package again:

dpkg --configure -a

Step 9: Enable the Apache proxy module, copy the Nextcloud virtual host configuration file to a new file for the ONLYOFFICE reverse proxy, and edit the new configuration file:

a2enmod proxy_http
cp /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-available/onlyoffice.conf
nano /etc/apache2/sites-available/onlyoffice.conf

Change the ServerName to your ONLYOFFICE subdomain, comment out the DocumentRoot item, and add the proxy configuration:


ProxyPreserveHost On
ProxyPass "/" "http://localhost:81/"
ProxyPassReverse "/" "http://localhost:81/"

<IfModule mod_headers.c>
RewriteEngine On
SetEnvIf Host "^(.*)$" THE_HOST=$1
RequestHeader set X-Forwarded-Proto "https"
ProxyAddHeaders Off

Step 10: Enable the new virtual host, reload Apache, and get a TLS certificate from Let's Encrypt:

a2ensite onlyoffice
systemctl reload apache2
certbot --apache

Step 11: Stop ONLYOFFICE and rebuild the spell checker from source:

supervisorctl stop all
apt install build-essential git npm
cd /var/www/onlyoffice/documentserver/server/SpellChecker/
mv node_modules/ node_modules_old/
npm install

Step 12: Set a password for usage of the ONLYOFFICE server by editing this configuration file:

nano /etc/onlyoffice/documentserver/local.json

Set the following options to the appropriate values:

services.CoAuthoring.token.enable.request.inbox -> true
services.CoAuthoring.token.enable.request.outbox -> true
services.CoAuthoring.token.enable.browser -> true
services.CoAuthoring.secret.inbox.string -> P@ssw0rd
services.CoAuthoring.secret.outbox.string -> P@ssw0rd
services.CoAuthoring.secret.session.string -> P@ssw0rd

Step 13: Start the ONLYOFFICE server:

supervisorctl start all

Step 14: Install the ONLYOFFICE app in Nextcloud, navigate to Settings -> Administration -> ONLYOFFICE, and set the document server address and secret key/password. After clicking Save, the rest of the preferences will populate, and you can set them as you wish.

There are no pages beneath this page

Expand: Discussion Discussion (0 posts)