NextCloud in Docker behind Cloudflare (self-hosted locally)

Hi. I want to securely host NextCloud on a Synology NAS for a small group of friends and family. I only plan to use Nextcloud Photos.

I’d like to use Docker and put everything behind Cloudflare, which points to a domain I own. I’d also like to use a reverse proxy so that I can add other services at the NAS level (I already have a couple).

I’m looking for guides to work from and have only found content farm-level stuff, plus the “official” all-in-one guides, which are either quite general, or in the case of the reverse proxy docs, so incomprehensible as to be unreadable (probably from translation issues and a lack of time).

Right now, my domain is using Cloudflare DNS and I’m working out what to add to a docker-compose. I’m expecting it to be NextCloud, its database, and the Cloudflare tunnel, but I’m not sure what else.

Thanks in advance for any guidance!

Hi, can you point out a bit more in detail why you find them unreadable? What would you change about them in order to be better readable?

Hi @szaimen I’d be glad to if you DM me. I’d like to keep this thread about how to work through my installation though.

Suprised to get no information at all when there aren’t any clear guides for this seemingly common use case. Does a reply bump the thread in this forum? I’ll try it once.

This forum provides many valuable information and guides - use search and you’ll find my comprehensive docker compose guide. Using cloudflare has nothing to do with the system itself - it’s more about reverseproxy… but this is covered by AiO docs and discussed on this forum multiple times already.

Majority of the users in this forum participate in their spare time - this very unfriendly to nudge them! please stop it!

1 Like

Hi Will, you don’t seem to be a mod, so I’m not sure your comment about my nudge is appropriate. And, kindly don’t tell me to “please stop it,” since that sounds like grammar school and is rather self-important :slight_smile:

If you want to contribute in a positive way, you can suggest guides for using Cloudflare with NextCloud, aside from the official docs. As previously noted, those are impossible to follow and actually admit that in their first sentence!

Another quick note is that it’s quite rude to tell me to search so that I find your guide (but without actually just linking your guide in your response).

And finally, just an general comment that this issue is caused by the docs. The docs literally link to a forum thread where people are asked to contribute their working docker-compose so others can “learn” from that. People in the comments (those whose comments aren’t deleted) note that this is incredibly confusing and wastes hours. Why not document all the docker-compose options instead and then have one topic with ~ten examples?

Full disclosure: I do documentation and user experience for a living. Until the docs issue is fixed, people will continue to come to the forums and ask the same questions over and over :slight_smile:

1 Like

Because it is basically impossible and unmaintainable to document all possible reverse proxy examples in different ways of how things can be set up.

All right. Then I would really appreciate a PR that improves our documentation.

Thanks a lot! I’ve already DM’ed you directly yesterday in https://help.nextcloud.com/t/aw-nextcloud-in-docker-behind-cloudflare-self-hosted-locally/194675. Hope you got the message? Btw, maybe this helps? https://github.com/nextcloud/all-in-one/discussions/2845#discussioncomment-6423237

1 Like

Thanks! I answered your DM (as a reminder if you didnt get the notification)…

You find the answer by watching Youtube videos eg on the Synology NAS you are likely going to need to set up docker containers for:

  1. NextCloud
  2. A proxy manager like NginxProxy Manager.
    Then depending on your Internet connection are you on CGNAT, DDNS or StaticIP? as StaticIP is easy with Cloudflare to create a subdomain for your domain and point that subdomain to your staticIP then you need to forward ports 80 & 443 on your router to your synology NAS’s NgnixProxy Manager docker container that it will then forward that subdomain (for nextcloud) to the nextcloud docker container.

If you have from your Internet provider a DDNS meaning the WAN IP address to your router changes then docker container number 3 for a Cloudflare DDNS to detect any WAN IP address changes and update it automatically with cloudflare so people can access the NAS. If your Internet provider is using CGNAT then best to just contact them and see if you can get off it.

In other words its complex and you are going to need a Video guide and a lot of time if you are 100% new to this. By the way I went the build my own NAS and the Unraid route because its more user friendly with a lot of guides for people that are new to this.

I didn’t need YouTube. In my (definitely individual) opinion, it makes these installations worse since those guys are all rushing through and don’t explain why it will work (so you don’t learn anything).

CloudFlare was easy once I had worked out a docker-compose. It was only a question of tracking that info down—there is nothing extra challenging about Cloudflare, as far as I can tell. I had no issues.

I’m a technical writer, so I was considering writing a guide to how I implemented NextCloud with Cloudflare, since the main one I see on the forums is rather down in the weeds and hard to follow, despite presumably having great intentions.

But, after I installed NextCloud, I had disk usage issues that I tracked to the postgres process (it was trying to update and thrashing my disks). I looked for info, found none, posted the issue, got no response, and decided not to use NextCloud anymore.

It’s probably a great product, but it’s too heavyweight for my use case (photo-sharing). Also, I see a lot of folks having problems with upgrades, which would be a huge issue for a self-hosted app that’s exposed to the web.

The deleted posts above were actually a misguided attempt to delete my forum data. It seems you can’t do that.

Hi there,

don’t usually check the summary emails I get from this community but the title of your post caught my attention as it’s my exact setup as well.

I can understand your desire for a thorough guide, hell I would like that myself. but in the FOSS community that is just unfeasible, it’s just the reality of the situation.

I just take the philosophy of “be the change you want to see” so I document everything I do and try to put it online.

if it helps at all, I made a guide on my own github repo for myself after a friend suggested I share my setup online: GitHub - modernNeo/homelab_infra

it’s a very up to date guide given that I recently finally setup my nextcloud only a month or so ago.

Also, I see a lot of folks having problems with upgrades, which would be a huge issue for a self-hosted app that’s exposed to the web.

I gotta take issue with that. the one time I had an issue updating a dockerized nextcloud was because I had neglected to do updates for like 1 year or 2 so I had to go through like 2-3 versions to get to the latest. It’s surprisingly easy to do an update imo. If you have seen folks complaining, I am willing to bet it’s because they either

  1. didn’t follow the instructions correctly
  2. were not properly understanding what they were doing
  3. had it highly customized

Hi. I disagree with your assessment of FOSS docs. That’s the default state, but some—even very small—projects do have docs that can get you there, not to mention the ones with professional curators/writers. Just to name one: OpenTelemetry. That actually is FOSS and that guy is at the top of my field—of course, he works for Splunk :rofl:

But, as I noted elsewhere, it’s too much to handle if you’re also the dev. For NextCloud, the current situation isn’t working. They’re a big enough name that they might be able to dedicate a resource now, or at least leverage one of the free models. By not doing that, they’re hurting their brand.

On the install part, I also don’t agree. Just a quick search indicated that upgrade issues are common. It’s too convenient to say these are all PEBKAC errors. If one has an extensive history of PEBKAC errors from upgrades, that’s an issue to be solved if you don’t want to lose users.

Just some thoughts.