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.

4 pensieri su “Nextcloud/ownCloud on the same host as Zimbra

  1. Hi, thank you for this. I had a quick question for clarification. Does this tutorial provide instructions on how to install Nextcloud/ownCloud on the same physical server as Zimbra? Or does it provide instructions on how to to access Nextcoud/ownCloud (which is on a different physical server, server #2) by navigating to https://server1/nextcloud? In your example above is “your-upstream-server” a different server from the server that zimbra is installed on? Thank you for your help.

    • Actually it’s the same. “your-upstream-server” can either be a different server or a new instance of nginx on the same server as Zimbra

  2. Thank you for your quick response. For some reason I can’t get it to work. To eliminate any possibility that the problem was with my second server I replaced “your-upstream-server/nextcloud/” with “www.microsoft.com/”. I still get a 404 error when navigating to https://mydomain/nextcloud/ Strange?

  3. Nevermind, I fixed it. I had to edit the file in the includes directory not the template directory. /opt/zimbra/conf/nginx/includes/nginx.conf.web.https.default Thank you.

Lascia un commento

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

Solve : *
3 + 10 =


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