Private Cloud Office

Replace Gsuite O365

Private Cloud Office . Self-Hosted Office . Business Email . Domain for Life . Buy Now

How to Install OnlyOffice Document Server For Nextcloud, Fast & Easy

I’ve wasted a ridiculous amount of time trying to get the Collabora / LibreOffice / CODE platform integrated with my Nextcloud 11 server.  I wanted to have Google Docs-style editing, but it was turning out to be a massive headache.  One day, on accident, I stumbled on an OnlyOffice plugin for OwnCloud.  After a little digging, I found out it worked with NextCloud as well.  Less than 15 minutes later, I had the OnlyOffice Document Server packages installed on a second Ubuntu 16.04 server and it was fully integrated with my NextCloud server.


What You Need


For this guide, you will ultimately need the following:

  • A 2nd Ubuntu 16.04 or 16.10 Server
  • A Valid SSL Certificate (A FREE LetsEncrypt Certificate Will Do)
  • A Valid DNS Entry for Both Servers (for this guide, you are required to use onlyoffice.yourdomain.tld, custom OnlyOffice domains are out of the scope of this guide)


Installing Dependencies


OnlyOffice requires a few dependencies.  Mainly, nodejs, postgresql, and nginx.  In addition, we’ll need to enable a repo for up-to-date ttf-mscorefonts-installer packages.


First, let’s go ahead and add the needed repo’s.


echo "deb precise main universe multiverse" | sudo tee -a /etc/apt/sources.list
curl -sL | sudo bash -


Next, install postgresql.


sudo apt-get install postgresql


For the scope of this guide, the database must be called onlyoffice, and the username and passwords both need to be set to onlyoffice as well.  I suggest configuring a firewall, such as UFW, to secure your server.


To create the onlyoffice database and assign a username and password, do the following:


sudo -u postgres psql -c "CREATE DATABASE onlyoffice;"
sudo -u postgres psql -c "CREATE USER onlyoffice WITH password 'onlyoffice';"
sudo -u postgres psql -c "GRANT ALL privileges ON DATABASE onlyoffice TO onlyoffice;"


Next, install redis for caching.


sudo apt-get install redis-server


And finally, install rabbitmq.


sudo apt-get install rabbitmq-server


Install OnlyOffice Document Server


To install the OnlyOffice Document Server packages, we’ll need to add the repo, as well as its GPG key.


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

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


Update the Apt package manager’s list of available packages.


sudo apt-get install onlyoffice-documentserver


Now, we can install the OnlyOffice Document Server Packages.


sudo apt-get install onlyoffice-documentserver


After all packages have been installed, you should be able to browse to your OnlyOffice Document server via http://yourdomain.tld (https is not set up yet), although you will not be able to do anything with it directly beyond verifying it is working.  It will look like this.


OnlyOffice Document Server


The service name for the OnlyOffice Document Server is supervisor.  This service needs to be configured to start at boot, as well as redis-server, rabbitmq, and nginx.


sudo systemctl enable redis-server

sudo systemctl enable rabbitmq-server

sudo systemctl enable supervisor

sudo systemctl enable nginx


Those services will now start automatically on boot.  Next, you will need to obtain SSL certificates (I suggest using certbot to obtain them from Let Encrypt).  After you have obtained certificates, you can enable SSL on the OnlyOffice Document Server by doing the following.


sudo nano /etc/nginx/conf.d/onlyoffice-documentserver.conf


Select everything in this file and delete.  Once the file is completely blank, paste or add the following contents to the file.  Be sure to edit the items in red, pertaining to your server name and SSL certificate locations.


include /etc/nginx/includes/onlyoffice-http.conf;
## Normal HTTP host
server {
listen [::]:80 default_server;
server_name onlyoffice.yourdomain.tld;
server_tokens off;
## Redirects all traffic to the HTTPS host
root /nowhere; ## root doesn't have to be a valid path since we are redirecting
rewrite ^ https://$host$request_uri? permanent;
#HTTP host for internal services
server {
listen [::1]:80;
server_name localhost;
server_tokens off;
include /etc/nginx/includes/onlyoffice-documentserver-common.conf;
include /etc/nginx/includes/onlyoffice-documentserver-docservice.conf;
## HTTPS host
server {
listen ssl;
listen [::]:443 ssl default_server;
server_name onlyoffice.yourdomain.tld;
server_tokens off;
root /var/www/html;

ssl on;
ssl_certificate /etc/letsencrypt/live/onlyoffice.yourdomain.tld/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/onlyoffice.yourdomain.tld/privkey.pem;

ssl_ciphers "ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA128:\
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security max-age=31536000;
add_header X-Content-Type-Options nosniff;

######  The lines below will allow LetsEncrypt and/or Certbot to obtain & renew SSL certificates
location ~ /.well-known/acme-challenge {
root /var/www/onlyoffice/;
allow all;
include /etc/nginx/includes/onlyoffice-documentserver-*.conf;


Save and exit, then restart nginx and supervisor.


sudo systemctl restart nginx

sudo systemctl restart supervisor


Now you should be able to browse to your OnlyOffice Document Server using SSL / HTTPS (https://yourdomain.tld)


Next, you will need to add the OnlyOffice plugin to your NextCloud Server.  To do so, SSH into your NextCloud server, and download the plugin.


cd apps/
git clone onlyoffice


Open your web browser and log in to your NextCloud server, then go to Settings > Admin > OnlyOffice.  Enter the address of your OnlyOffice Document Server (be sure to use https)



OpenOffice NextCloud Configuration
Now, click Files on your NextCloud server, the click the plus button.  You should now have the option to create new Word Processor, Spreadsheet, and Presentation documents.  Enjoy!


OnlyOffice Nextcloud Create Document


Once you do so, you will now have your own Google Docs / Office 365 type of applications integrated on your NextCloud server!


OnlyOffice Spreadsheet Nextcloud


If you have any questions, please feel free to ask

Private Cloud Office . Self-Hosted Office . Business Email . Domain for Life . Buy Now Private Cloud Office . Self-Hosted . free Download . Blog . Managed Hosting . Business Email . GDPR . Testimonials . Reddit Forum . Lang . Video Demo . Tutorials . Partners . Price Advantage . Utils . Wordpress . AdBlocker . Manuals . Privacy . About Us . BUY PRO +54911 2546 1403 - Private Cloud Office Hosting Replace O365 Managed Nextcloud Onlyoffice MS Microsoft Office Compatible Word Document Sharepoint Spreadsheet Excel Power Point Presentation Self-Hosted Premises Collaboration Groupware Talk Chat Teleworkers Remote Teams Office 365 G suite Gsuite Basecamp Slack Alternative back office gdpr cipa affordable easy enterprise files backup restore cloud storage server msp isp About