In this post we we’ll address the following, very specific scenario:

We wan’t to use the OnlyOffice Document Server on a Subdomain (for example office.endorwind.de) together with other subdomains and want to secure this connection via HTTPS and Let’s Encrypt certificate. We will use Apache2 as our webserver and Ubuntu 16.04 as our OS.

In this tutorial I will only address the steps, with differ from a standard OO installation, for – let’s say – Nginx.

Step 1 –  Install OO Document Server using Docker

First of all we’ll install the OO Document Server using docker. If you don’t have Docker already installed follow this tutorial.

sudo docker run --restart=always -i -t -d -p 8888:443     -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data  onlyoffice/documentserver

With the above command we bind port 8888 to port 443. You can change the 8888 port to whatever port you like.

Step 2 – Create a new domain and install LE certificate

Follow this tutorial to set up a domain with Apache and follow this tutorial to install a certificate with Let’s Encrypt for this domain.

Step 3 – Configure Apache as Proxy

Now the magic happens: Go into your Apache2 config file for the domain you are using (if you followed the linked tutorials it should be office.endorwind.de.conf ) and replace the *.443 VirtualHost with the following:

<VirtualHost *:443>
  ServerName office.endorwind.de

  SSLEngine on
  SSLProxyEngine on
  SSLProxyVerify none
  SSLProxyCheckPeerCN off
  SSLProxyCheckPeerName off
  
  SSLCertificateFile /etc/letsencrypt/live/office.endorwind.de/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/office.endorwind.de/privkey.pem
  Include /etc/letsencrypt/options-ssl-apache.conf
  
  ProxyPreserveHost On
  ProxyPass / https://office.endorwind.de:8888/
  ProxyPassReverse / https://office.endorwind.de:8888/
</VirtualHost>

Then enable the Apache HTTP Proxy Module with

sudo a2enmod proxy_http

and restart Apache.