Hello to the Community,
I will write here some tips you should know for having OnlyOffice working on the same host as your Nextcloud instance if youâre using APACHE2 as a WebServer.
I didnât find a tutorial about this case, theyâre all speaking about Ngnix
So what do you need first :
Apache2
A working Nextcloud Instance with SSL
Docker
Some RAM in your computer
Iâm on a Debian/Ubuntu server.
First of all lets enable the Apache modules you will need with some commands :
a2enmod proxy a2enmod proxy_wstunnel a2enmod proxy_http a2enmod headers
Then a little bit of pre-work about your installation :
Let says your nextcloud instance is on that URL : mycloud.mydomain.com
We want to create another subdomain like this : myoffice.mydomain.com
So first you have to go to your DNS configuration of your Domain provider to add this host, do the same that you did for your nextcloud instance.
On the system we will modify a file for letting the system know that myoffice.mydomain.com is itself :
Modify this file with nano/vi/vim whatever you know best :
nano /etc/hosts
and add/modify the first line to have something like this :
127.0.0.1 localhost mycloud.mydomain.com myoffice.mydomain.com
save and exit
Now a big task to do, create an Apache2 Virtual host for myoffice.mydomain.com,
create with nano/vi/vim whatever this file :
nano /etc/apache2/sites-avialable/myoffice.conf
And Modify the file depending of your domain :
<VirtualHost *:80>
ServerName myoffice.mydomain.com
RewriteEngine on
RewriteCond %{SERVER_NAME} =myoffice.mydomain.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
Now we will enable this virtual host :
a2ensite myoffice.conf
service apache2 reload
Now you have to create the same host for the SSL version, so you have to create Cert as you want with LetsEncrypt or Verisign etc⊠(follow some tutos if you want to use LetsEncrypt if youâre a newbie)
When you have your certs, lets create or modify the SSL version of myoffice.conf. As i use LetsEncrypt it created and enabled automaticly this myoffice-le-ssl.conf
Servername myoffice.mydomain.comSSLEngine on
SSLCertificateFile â/etc/letsencrypt/live/myoffice.mydomain.com/fullchain.pemâ #Change with the right path
SSLCertificateKeyFile â/etc/letsencrypt/live/myoffice.mydomain.com/privkey.pemâ #Change with the right pathSSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLCompression off
SSLHonorCipherOrder on
Header always set Strict-Transport-Security âmax-age=15768000; includeSubDomainsâ
SetEnvIf Host â^(.*)$â THE_HOST=$1
RequestHeader setifempty X-Forwarded-Proto https
RequestHeader setifempty X-Forwarded-Host %{THE_HOST}e
ProxyAddHeaders OffProxyPassMatch (.*)(/websocket)$ âws://127.0.0.1/$1$2â
ProxyPass / âhttp://127.0.0.1/â
ProxyPassReverse / âhttp://127.0.0.1â
Save and reload apache2, donât forget to enable this site if it isnât the case :
a2ensite myoffice-le-ssl.conf
service apache2 reload
Now lets get the docker image :
docker pull onlyoffice/documentserver
Wait a moment, now we have to create some folders to map with the docker instance of DocumentServer for ease of use, and to update without pain the docker image.
mkdir /app
(itâs my exemple, you can create this folder where you want but donât forget to follow my tuto with this modification)
Now lets start the Docker image :
docker run -i -t -d -p 80:80 --restart always -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql onlyoffice/documentserver
If you have errors because port 80 is already use, then modify the myoffice-le-ssl.conf, the last line should look like this :
ProxyPassMatch (.*)(/websocket)$ âws://127.0.0.1:81/$1$2â
ProxyPass / âhttp://127.0.0.1:81/â
ProxyPassReverse / âhttp://127.0.0.1:81â
And so the docker command line will be :
docker run -i -t -d -p 81:80 --restart always -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice -v /app/onlyoffice/DocumentServer/data:/var/www onlyoffice/Data -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql onlyoffice/documentserver
Now you should go to your Admin Nextcloud Instance,
Download the Onlyoffice App,
Go to your admin panel of Nextcloud â OnlyOffice page and configure it like this :
Document Editing Service address â https://myoffice.mydomain.com
DO NOT CLIC ON Advanced Settings, itâs useless for this setup and wonât work
Feel free to tick or untick the other boxes, and save.
Normaly itâs working