[Tutorial] How to get the edition feature for your documents in NextCloud (using Collabora plugin)

Hi

Having lost a lot of time in search since a while for an easy solution, I’m happy to share the nice way to do it in a virtualhost in Virtualmin without breaking everything ! The idea is that one:
you have setup a Nextcloud or Owncloud in Virtualmin and you want to be able to get a full “Google” drive where you can edit files directly in web browser in shared mode

Let’s see how to do that in an easy way (tutorial based on OS Ubuntu 16.04 with Virtualmin/webmin up-to-date and you need either SSH access at server or use the mini-terminal included in Virtualmin):

  • Your Nextcloud instance has to be correctly setup and working (NC 14 minimum) in a virtualhost in Webmin with a Let's Encrypt certificate setup on it.
  • We have first to install the Collabora app in package mode, we don't want the docker version ! All steps are clearly indicated and easy to follow on that page: https://www.collaboraoffice.com/code/linux-packages/ (be careful, do all steps excepted the 4th one, we'll see that later, something to do first !)
  • Now we need a local copy of SSL certificate for the Collabora service too (it can't access directly the SSL certificate of your virtualhost). Easier way for now is to copy basically all ssl files present at root of your virtualhost (default settings in Virtualmin) in the /etc/loolwsd directory and 777 the files for now.
  • You can now restart the loolwsd service so settings are now applied.
  • Next step is to configure the app/service we just installed. All configuration is in file /etc/loolwsd/loolwsd.xml You can edit it using the integrated file browser of Webmin and only things to change are these ones: /etc/loolwsd/ssl.cert /etc/loolwsd/ssl.key /etc/loolwsd/ssl.ca As you can see I changed the default SSL files path to directory of Collabora settings so now Collabora will use same SSL CERT as website of my Nextcloud instance.
  • Now we need to install/check few needed apache modules are well installed (they should be on most systems but better to check before using them if you don't want to have a problem next time you restart Apache !). In console on your Virtualmin server, you'll have to do these commands to install/activate needed Apache modules: a2enmod proxy a2enmod proxy_wstunnel a2enmod proxy_http and then you can restart Apache to activate the new modules.
  • Now we need to edit SSL website properties of Nextcloud instance in Virtualmin. Here I'm based on Apache but it's probably pretty similar if running Nginx ! You'll find all details on that page of Collabora website: https://www.collaboraoffice.com/code/apache-reverse-proxy/ at chapter "SSL on both ends". It's pretty simple: you just copy/paste that part of directives in your virtualmin apache directive for your Nextcloud virtualhost. # Encoded slashes need to be allowed AllowEncodedSlashes NoDecode

    Container uses a unique non-signed certificate

    SSLProxyEngine On
    SSLProxyVerify None
    SSLProxyCheckPeerCN Off
    SSLProxyCheckPeerName Off

    keep the host

    ProxyPreserveHost On

    static html, js, images, etc. served from loolwsd

    loleaflet is the client part of Collabora Online

    ProxyPass /loleaflet https://127.0.0.1:9980/loleaflet retry=0
    ProxyPassReverse /loleaflet https://127.0.0.1:9980/loleaflet

    WOPI discovery URL

    ProxyPass /hosting/discovery https://127.0.0.1:9980/hosting/discovery retry=0
    ProxyPassReverse /hosting/discovery https://127.0.0.1:9980/hosting/discovery

    Capabilities

    ProxyPass /hosting/capabilities https://127.0.0.1:9980/hosting/capabilities retry=0
    ProxyPassReverse /hosting/capabilities https://127.0.0.1:9980/hosting/capabilities

    Main websocket

    ProxyPassMatch “/lool/(.*)/ws$” wss://127.0.0.1:9980/lool/$1/ws nocanon

    Admin Console websocket

    ProxyPass /lool/adminws wss://127.0.0.1:9980/lool/adminws

    Download as, Fullscreen presentation and Image upload operations

    ProxyPass /lool https://127.0.0.1:9980/lool
    ProxyPassReverse /lool https://127.0.0.1:9980/lool


    You can then save the file and restart apache so new directives are applied.
  • Now you can login in your Nextcloud instante, install and activate the Collabora plugin and indicate in it URL of your nextcloud instance with https and now any text files you open in NextCloud should now open in edition mode in Collabora integrated in your Nextcloud instance !

Feel free to post comments for corrections, mistakes and hope it’ll help !

I’ll update it if needed (at least the SSL keys part as for now my trick is not really nice !

Vincèn

struggling with this to get going, not sure where i’m going wrong. I even tried to set up on separate domain name. the only difference is im doing this on Centos 7

AH01276: Cannot serve directory /home/office/public_html/: No matching DirectoryIndex (index.html,index.htm,index.php,index.php4,index.php5) found, and server-generated directory index forbidden by Options directive is what im getting, but i have:


DirectoryIndex index.html index.php

in the config for the domain that i have the collabora sitting