Nextcloud/ownCloud on the same host as Zimbra

Quick guide on how to serve Nextcloud or ownCloud on the same host as your Zimbra server, by changing few lines of Zimbra’s proxy service (based on nginx).

Zimbra’s nginx configuration files are stored in /opt/zimbra/conf/nginx/templates/. There are a lot of them but you can easily figure out their purpose because the file name is very explicative. We need to change the https web template, so our winner is nginx.conf.web.https.default.template.

Open it with your favourite editor and, just before the location / { line, add those three lines:

location ^~ /nextcloud/ {
    proxy_pass http://your-upstream-server/nextcloud/;
}

Of course you have to change your-upstream-server and the whole proxy_pass line with the url of the Nextcloud/ownCloud installation.

That’s all!
Now just restart the proxy service with zmproxyctl restart and you’re done!
BEWARE that this modification will get lost if Zimbra is upgraded/reinstalled! Remember to apply it after any of these action is performed.

Some background.
It is very important to leave the location line as is, or at least the operator just in the middle, becouse otherwise some Nextcloud urls (namely the /dav ones, used by sync clients) will conflict with a Zimbra’s own url, which is:

location ~* /(service|principals|dav|\.well-known|home|octopus|shf|user|certauth|spnegoauth|(zimbra/home)|(zimbra/user))/

This location directive forward all requests containing the word dav to Zimbra’s Jetty server, breaking your Nextcloud/ownCloud client sync. And you cannot change this line because it will affect CalDAV/CardDAV. Just leave as is and add the line above.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Solve : *
27 + 30 =


Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.