Nextcloud hinter einem NGX Proxy Probleme beim zugriff zwischen Extern und intern

Guten Tag

Ich hoffe es ist in Ordnung wenn ich die Anfrage auf Deutsch stelle.

Ich bin neu in dem Thema und habe mir jetzt eine Nextcloud mit der DietPi erstellt. Diese funktioniert auch wunderbar ich komme von intern auf die Nextcloud über http. Was ja auch erste mal reicht.

Jetzt möchte ich von unterwegs auch dort zugreifen können. Dafür habe ich mich einen NGX Proxy installiert und eingerichtet. Danke noch mal an die Video die waren sehr hilfreich.

Wenn ich jetzt von Extern mit einem Browser auf die Nextcloud zugreife geht das auch. Jetzt habe ich die App auf meinem Smartphone. Dort findet er zwar den Server und leite mich dann weiter zum Browser. Dort soll ich dann den zugriff gewähren. Dort bleibt er dann hängen und der kreisel dreht immer weiter.

Jetzt habe ich Einlösung dafür gefunden.

chmod 700 occ
sudo -u www-data ./occ config:system:set overwriteprotocol --value="https"

Damit setzte ich das Parameter overwrite in der /var/www/nextcloud/config/config.php

Damit klappt dann auch das einrichten der App. aber mit diesem Parameter kann ich nicht mehr auf die Nextcloud von intern zugreifen.

Gibt es eine Möglichkeit von beiden Seite zuzugreifen?

Ich als Leihe würde ja sagen das ich nur https auch intern zu aktiviern aber ich habe keinen Ahnung wie. vor allem da ich dort ja nicht mehr einer URL sondern Ip verbinde.

Was ich mir noch gedacht habe ich eine eigene URL erfinden und in meinem ADGuard auf die IP umleiten. Aber wie richte ich den Apache oder die Nextcloud ein da sich die etwas von der Normal Installation abweicht. Kann ich da mit einem selbst erzeugten Zertifikat arbeiten?

Danke schon mal für die Hilfe.

P.S. Ich werde den Text noch mal mit ChatGPT ins Englsche übersetzen:

Good day,

I hope it’s okay that I’m asking this in German.

I am new to this topic and have set up a Nextcloud with DietPi. It works perfectly, and I can access the Nextcloud internally via HTTP, which is fine for the time being.

Now, I would like to be able to access it remotely as well. To do this, I installed and configured an NGX Proxy. Thanks again for the videos, they were very helpful.

When I now access the Nextcloud externally via a browser, it works. I also have the app on my smartphone. It finds the server but then redirects me to the browser. There, I am asked to grant access, but it gets stuck and the loading circle keeps spinning.

I have found a solution for this.

chmod 700 occ
sudo -u www-data ./occ config:system:set overwriteprotocol --value="https"

This sets the overwriteprotocol parameter in the /var/www/nextcloud/config/config.php file.

This allows me to set up the app, but with this parameter, I can no longer access Nextcloud internally.

Is there a way to access it from both sides?

As a layman, I would say that I should enable HTTPS internally as well, but I have no idea how, especially since I am connecting via an IP rather than a URL.

What I also thought about was creating a custom URL and redirecting it to the IP in my ADGuard. But how do I configure Apache or Nextcloud since it deviates a bit from the normal installation? Can I use a self-generated certificate for this?

Thanks in advance for the help.

pls use English, we are an international community and use English as our main language.

Simply access your NC instance using https://my.domain.com/nextcloud from intern as well

could be a way, but you need to create a custom DNS record and not a URL :wink:

ensure to force a redirect from http > https in your configuration

I just installed nextcloud, no proxy or whatever needed. I created a cert with let’s encrypt, it also cares about the redirect from http to https.

Without extra config the mobile app functions and I can reach nextcloud from LAN and from Internet.

I also set a local DNS in PiHole, so my calls from inside the LAN to my nextcloud don’t need to travel through Internet. I just set my domain to the local IP of the nextcloud instance.

1 Like

correct, usually no proxy needed if you access NC only

Ich habe das jetzt so gemacht:

Ich habe auf meinem ADGuard eine DNS-Umschreibungen auf nc.domain.local gemacht. diese schicke ich dann auf meinem NingX Proxy. Dort habe ich dann Proxy Hosts wir die nc.domain.local eingerichtet. Leider schlägt das erstellen des Zertifikats immer wieder fehl.

Ich habe jetzt erste mal das Zertifikat von meinem Externen Zugang benutzt.

Dann habe ich das Overwrite wieder gesetzt. Jetzt komme ich auch auf meine Netxtcloud. Nur mit einem Zertifikatsfehler weil ja eine andere Adresse im Zertifikat steht.

Ich weiß halt nicht ob es wegen der Endung local nicht geht. Entweder muss ich ein gültige Endungen nehmen und so einen doofen Domain Namen das dieser nie erstellt wird oder ich muss es so lassen. Hat schon einer von euch Erfahrung mit Let’s Entcrypt?

ChatGPT:

I’ve done it like this:

I’ve set up a DNS rewrite on my ADGuard to nc.domain.local. This then forwards to my Nginx Proxy. There I’ve set up Proxy Hosts like nc.domain.local. Unfortunately, the creation of the certificate keeps failing.

For now, I used the certificate from my external access.

Then, I set the overwrite again. Now I can access my Nextcloud, but there’s a certificate error because a different address is listed in the certificate.

I’m not sure if it’s not working because of the “local” suffix. Either I need to use a valid suffix and come up with a weird domain name that will never be created, or I need to leave it like this. Has anyone here had experience with Let’s Encrypt?

P.S.

Ich habe jetzt eine Lösunge gefunden. Ich habe mit einen Eintrag im NingX “intern.doamin.dyndns.org” erstellt. dafür habe ich dann ein Zertifikat bekommen. Das funktioniert jetzt auch von intern. Natürlich habe ich das dann auch im AdGuard angepasst.

ChatGPT:

P.S.

I have now found a solution. I created an entry in NingX “intern.domain.dyndns.org”. For that, I received a certificate. It now works from the internal network as well. Of course, I also adjusted it in AdGuard.

pls don’t post anything in German, it doesn’t make that much of a sense. English only is totally fine. Using DeepL or ChatGPT to translate is fine as well.

wrong approach. You need to create a DNS record your external DDNS, not something local. And you need to access NC same way, using DDNS. Doesn’t matter if you in- or outside your network.

You are making it a little too complicated for yourself if you use a revers proxy. If there is no other need/app you are fine staying with your web server only to access NC. Revers proxy only make sense if you have multiple app you like to reach from extern.