OnlyOffice

Install OnlyOffice Document Server Ubuntu 18.04

Add the repository containing the up-to-date Node.js package versions:
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
Install postgresql:
apt install postgresql
Create Database (Type each command seraparately):
/usr/bin/sudo -i -u postgres psql -c "CREATE DATABASE onlyoffice;"
/usr/bin/sudo -i -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -i -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"
Install Redis:
sudo apt-get install redis-server
Install rabbitmq:
sudo apt-get install rabbitmq-server

Install nginx-extras:

sudo apt-get install nginx-extras
Install Document Server (Type each command seraparately):
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
sudo echo "deb http://download.onlyoffice.com/repo/debian squeeze main" | sudo tee /etc/apt/sources.list.d/onlyoffice.list
sudo apt-get update
sudo apt-get install onlyoffice-documentserver

Note: During the installation process, you will be prompted with the following screen (Figure 1):

Figure 1

image-1608637473525.png

Please enter the onlyoffice password that you have specified when configuring PostgreSQL.

Rebuild spellchecker (Ubuntu 18.04):
Update npm:
sudo npm install -g npm
Stop Document Server services:
sudo supervisorctl stop all
Install the components necessary for the build:
sudo apt-get install build-essential git
Switch to the spellchecker folder:
cd /var/www/onlyoffice/documentserver/server/SpellChecker/
Delete the older build:
sudo mv node_modules/ node_modules_old/
Install the dependencies:
sudo npm install
And finally start back Document Server services:
sudo supervisorctl start all
Verify that OnlyOffice Document Server is running:

Using a browser browse to the IP address of the OnlyOffice Document server Ex: http://192.168.xxx.xxx. You should get the following page (Figure 2):

Figure 2

image-1608637552646.png

Configure OnlyOffice Document Server to use HTTPS:
Stop NGINX service:
sudo service nginx stop
Create /etc/nginx/ssl directory to store certificates and keys:
mkdir /etc/nginx/ssl

Obtain the necessary certificates and keys from a 3rd party trusted Certificate Authority before going further

Place 3rd party certificate and key in /etc/nginx/ssl directory as below:

/etc/nginx/ssl/office.pem

/etc/nginx/ssl/office.key

Backup existing ds.conf file:
cp /etc/onlyoffice/documentserver/nginx/ds.conf /etc/onlyoffice/documentserver/nginx/ds.conf.BACKUP
Copy ds-ssl.conf.tmpl to ds.conf:
cp /etc/onlyoffice/documentserver/nginx/ds-ssl.conf.tmpl /etc/onlyoffice/documentserver/nginx/ds.conf
Edit new ds.conf file and replace all parameters with double curly brackets {{ }} for the actual values:
vi /etc/onlyoffice/documentserver/nginx/ds.conf

So it looks like below:

ssl_certificate /etc/nginx/ssl/office.pem;
ssl_certificate_key /etc/nginx/ssl/office.key;

Additionally, edit the ssl_protocols line and remove all but TLSv1.2 entries so it looks like below:

ssl_protocols       TLSv1.2;
Start NGINX service:
sudo service nginx start
Verify that OnlyOffice Document Server is running on HTTPS:

Using a browser browse to the IP address of the OnlyOffice Document server Ex: https://192.168.xxx.xxx. You should get the following page (Figure 3):

Figure 3

image-1608637709258.png

Restict Access to OnlyOffice Document Server to Nextcloud Users Only

ONLYOFFICE Document Server can use a token generated using the JSON Web Tokens (JWT) standard in order to secure the connection and restrict access the the OnlyOffice Document server which by default is accessible to everyone.

sudo vi /etc/onlyoffice/documentserver/local.json
"token": {

        "enable": {

          "request": {

            "inbox": false,

            "outbox": false

          },

          "browser": false
"token": {

        "enable": {

          "request": {

            "inbox": true,

            "outbox": true

          },

          "browser": true
"secret": {

        "inbox": {

          "string": "secret"

        },

        "outbox": {

          "string": "secret"

        },

        "session": {

          "string": "secret"
"secret": {

        "inbox": {

          "string": "ThisisTheSecret"

        },

        "outbox": {

          "string": "ThisisTheSecret"

        },

        "session": {

          "string": "ThisisTheSecret"
sudo supervisorctl restart all

 

Figure 1

image-1608566322223.png

Figure 2

image-1608566341479.png