How to install ONLYOFFICE Document Server using Nginx on Debian 10

How to install ONLYOFFICE Document Server using Nginx on Debian 10

In this tutorial, we will show you how to install Onlyoffcie Document Server on the latest Debian Buster 10. We will install Onlyoffice Document Server on PostgreSQL, Nginx and Letsencrypt.


To install at least Onlyoffice Document Server, you need a Debian server with 2GB RAM, 4GB SWAP, 2 CPUs and 40GB of available disk space.

What are we going to do:

  • Install package dependencies
  • Install and configure PostgreSQL
  • Generate SSL Letsencrypt and DHPARAM
  • Install Onlyoffice Document Server
  • Use HTTPS to run the Onlyoffice document server
  • testing

Step 1-Install package dependencies

In the first step, we will install some package dependencies required by the document server, including RabbitMQ server, Redis and Nginx-extras.

Use the following apt command to update the Debian system repository and install the Document Server package dependencies.

sudo apt updatesudo apt install redis-server rabbitmq-server nginx-extras gnupg2

Once all installations are completed, use the systemctl command to check the following services, as shown below.

systemctl is-enabled nginxsystemctl is-enabled rabbitmq-serversystemctl is-enabled redis-server

Now, make sure that all these services are enabled and will run automatically when the system starts.

Step 2-Install and configure PostgreSQL database

In this step, we install the PostgreSQL database on Debian Buster 10 and create a new database, and use Onlyoffice Document Server.

Now, use the following apt command to install the PostgreSQL database.

sudo apt install postgresql

After the installation is complete, start the PostgreSQL service and add it to the system boot.

systemctl start postgresqlsystemctl enable postgresql

As a result, the PostgreSQL database is up and running on the Debian server.

Next, we will create a new database and role for the Document Server installation.

Use the following command to log in to the PostgreSQL shell.

sudo -i -u postgres psql

Create a new database using the following PostgreSQL query, and set the user name as “onlyoffice” and the password as “onlyoffice”.

CREATE DATABASE onlyoffice;CREATE USER onlyoffice WITH password 'onlyoffice';GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;

As a result, a PostgreSQL database was created for Onlyoffice Document Server.

Step 3-Generate SSL Letsencrypt and DHPARAM

In this tutorial, we will run the document server on a secure HTTPS protocol and generate a new SSL certificate from let and generate a DHPARAM certificate.

Use the following apt command to install the Certbot tool to generate an SSL Letsencrypt certificate.

sudo apt install certbot

Next, use the certbot command below to generate a new SSL certificate and make sure to use your own domain name and email address to make changes.

certbot certonly --standalone --agree-tos -m [email protected] -d

Once the certbot command is complete, your SSL certificate will be located in the ‘/etc/letsencrypt/live/’ directory.

And you have successfully generated SSL Letsencrypt using the certbot command line tool.

Next, we will use the openssl binary command to generate the DHPARAM certificate.

Go to the “/ etc / ssl / certs” directory and use the following openssl command to generate the DHPARAM certificate.

cd /etc/ssl/certs/openssl dhparam -out dhparam.pem 4096

And your DHPARAM certificate is located in the “/ etc / ssl / certs” directory.

Therefore, you have generated SSL Letsencrypt and DHPARAM for the document server.

Step 4-Install ONLYOFFICE document server

In this step, we will install Onlyoffice Document Server. Although the available repository is for Debian Squeeze, it can run on the latest Debian Buster 10.

First, add the GPG key of Onlyoffice Document Server to the Debian system.

sudo apt-key adv --keyserver hkp:// --recv-keys CB2DE8E5

Now add the document server repository.

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

Add Onlyoffice repository

After that, use the following apt command to update the Debian repository list and install Onlyoffice Document Server.

sudo apt updatesudo apt install onlyoffice-documentserver

During the installation process, you will be asked about the PostgreSQL database password of the document server, type the “onlyoffice” database password, and then select “OK” to continue.

Onlyoffice PostgreSQL database password

And Onlyoffice Document Server installation will be completed. It runs on the default HTTP port 80 (accessible through a web browser).

Step 5-Run the document server on HTTPS

In this step, we will use the HTTPS protocol and SSL Letsencrypt and dhparam to protect the installation of the document server.

By default, Document Server provides its virtual host configuration for the Nginx Web server, located in the / etc / onlyoffice / documentserver / nginx / directory.

First, use the following systemctl command to stop the Nginx service.

systemctl stop nginx

Now go to the “/ etc / onlyoffice / documentserver / nginx /” directory and copy the virtual host template configuration of the SSL document server “ds-ssl.conf.tmpl” to “ds.conf”.

cd /etc/onlyoffice/documentserver/nginx/cp ds-ssl.conf.tmpl ds.conf

Now, use the vim editor to edit the Document Server configuration ‘ds.conf’.

vim ds.conf

On the ssl_certificate and ssl_certificate_key options, use the SSL certificate path to change the path.

  ssl_certificate /etc/letsencrypt/live/;  ssl_certificate_key /etc/letsencrypt/live/;

Uncomment the ssl_dhparam option and use your own comment to change the path of the DHPARAM certificate.

  ssl_dhparam /etc/ssl/certs/dhparam.pem;

Save and close.

Next, test the Nginx configuration and ensure that there are no errors, and then start the Nginx service.

nginx -tsystemctl restart nginx

As a result, Document Server is unable to run on an SSL HTTPS secure connection from Letsencrypt.

Use SSL Letsencrypt to protect Onlyoffice offices

Step 6-Test

Open a web browser and type the domain where Onlyoffice Document Server is installed in the address bar. Mine is:

Now, you will get the page showing Onlyoffice Document Server as shown below and running.

Onlyoffice Document Server installed on Debian Buster 10

As a result, Onlyoffice Document Server was successfully installed on Debian Buster 10 through PostgreSQL and Nginx web server.