Hello there - brand new here...
I also am way past what is my 'comfort zone'.
I am practically a total noob brute-forcing my way through to getting things to work.
What I am trying to set up is:
Already, docker-things seem to work fine.
But I installed Nextcloud as a Snap in Ubuntu, and I'm trying to route that through Traefik with the file-provider function...
I spent a week trying to read up on things (from understanding nothing), and now 3 days or so trying to set it up.
I was wondering if someone would mind to write a super basic template for how to get my 'scenario' working. (nothing else, no certificate or anything - that I'll yet try to learn soon)
-That isn't to assume upon the generosity of others or 'expect' that I just be handed things of course.
I meant to add that indeed I would understand if nobody would feel like 'assisting', since I'm gonna be pretty useless in understanding help - being pretty new to all this - I was just thinking if it was easy to write the most basic parts of the necessary 'code' to make that scenario work - so I can understand what I do wrong and ultimately get it to work of course.
I put Nextcloud to run on ports 81 and 444 for http and https respectively (since Traefik binds to ports 80 and 443 of course) - so what would I want to do in Traefik for it to hook into that and put either a subdomain or subdirectory on it - and deliver that from 80 and 443 to WAN clients?
Note also: that is all running on the same server, hence I can't have nextcloud listening on the same IP on 80 and 443
--- and that is about it for my main matter really... If however you want to read more (not recommended xD ) read on ahead. (I am not very concise in general, so I thought splitting up my novel into "point" and "rant" might be better)
I feel quite anxious having to write and bother others with this, but I thought at first it wouldn't be so hard for me to get up and running... I first started with Nginx, and found a guide online that made it seem... well... not easy per se, but it was easy to follow at least. But there were some thigns that didn't work - so I eventually went with Traefik which sounded simpler to run containerized things through.
I am not keen on posting my docker-compose and 'rules/nextcloud.toml' things here, since I figure it would be more effort to 'fix' my mess rather than just start over.
I've been fiddling so much with this my head is spinning, and I think I'm going delirious: suddenly I think I'm getting good ideas, and I realize shortly after it won't work either. and for a moment I came to the conclusion that...
Is my attempted setup impossible as-is?
Docker, Traefik and my Snap-Nextcloud all run on the same server.
naturally, again, I had to change Nextcloud's ports to not break Traefik's bind to 80 and 443.
But does Traefik have to bind itself to 81 and 444 as well, to be able to 'listen' on those?
I mean - would Nextcloud have to be on a separate server, runnning on 80 and 443, and then it would work? and it doesn't work, currently, because Traefik can't listen on 81 and 444 because, well, Nextcloud bound them?
Even as I'm writing this, I am pondering if I could circumvent that "issue" with runnnig Nextcloud only on a virtual network on the same server, to have it run on ports 80 and 443, but only on the virtual network. - but even then, it just doesn't work. I always get an 404 error.
At one point near the beginning, I thought I got the whole thing to work...
"http:// LANserverip:80/cloud" would forward me to suddenly be connected to
"https:// LANserverip:444/cloud" - actually sort of working.
However... I was under the impression I could 'hide' the fact that Nextcloud is listening on 81 and 444 if using subdomains or subdirectories through Traefik?... I think, similar to the idea of a DNS SRV-thing. (I think it was called that)
(Sorry my terminology is horrible)
Yes I am waaay over what I know to do... I have a basic course in networking that I can easily setup people's networks. I am hosting servers such as OpenVPN, Minecraft, XMPP, email, SIP (for myself and friends/family)... and they all work fine WAN-side (not to say that it 'shows' I am good... but at least I know some things - but reverse proxying has me utterly stumped, obviously).
I should maybe mention too that, all of that I already set up, and what I am trying to set up now - is all really just for fun. I don't need any of it in the least - but I enjoyed setting all that up so far, and the idea of a reverse proxy intrigued me a good bit.
For fun, I tried to change my nextcloud.toml file to instead 'forward' google.com through Traefik, but I still get a 404 error... so I figure I have something else fundamentally wrong in my setup, or I am completely misunderstanding how the functions work (I found many guides writing from start to end "what to do" but not explaining stuff like "look at this line: - --entryPoints.https.address=:443: here entryPoint is a command telling Traefik to 'look out' for stuff that come next - "https" is a variable and could be named potatoes instead..."
... but since none of them talk about exactly what I wanted to do, I had to sort figure out myself what the different functions do... and I'm too nooby to understand docs.traefik.io wording... though I thought I understood at least a bit, until none of my attempts at setting it up worked out : P
Anyway... I probably wrote quite enough.
Sorry in advance for my mess of a wall of text
Also sorry if my post break some community guidelines: I was just really eager to ask someone who knows about Traefik, because despite my best efforts and having a hundred Eureka! moments - my setup still never worked.
Naturally feel free to ask questions, but don't expect that I can even answer everything since my setup for Traefik has become quite Frankensteiny (like my domain names now seem to still forward :443/cloud to :444/cloud, even when Traefik isn't running, leaving me even more confused).
Oh and finally, here is my toml:
http: routers: nextcloud-router: entryPoints: - https - http - nextcloud81 - nextcloud444 service: nextcloud-service rule: "host(`foobar.duckdns.org`)" priority: 1000 services: nextcloud-service: loadBalancer: servers: - url: "https:// LANserverip:444" - url: "http:// LANserverip:81" middlewares: subdirectory: addPrefix: prefix: "/cloud" permanent: true
for the docker-compose file, everything is pretty much like how it starts out here*, with the addition of it listening to port 443 as well: * https:// docs.traefik .io/getting-started/quick-start/
I also defined:
- --entryPoints.nextcloud444.address=:444 - --entryPoints.nextcloud81.address=:81
I tried to open and close ports - pointing nextcloud to 127 .0.0.1:444 instead of LANserverip, and of course adjusting the toml file accordingly - but nothing even gave the hint of 'oooh, it's almost working' (though I guess that's rarely the case in IT/networking facepalm)
(as an extra thing... since Nextcloud also has some guidelines for how to configure it when putting it behind a reverse proxy, I instead also tried to reverse proxy my minecraft server in the same fashion, but it works just as well D: (Since I thought too, that maybe I am just adjusting nextcloud incorrectly) )
((Edit: I put some spaces in some of the 'links' since it wouldn't let me post here otherwise))