Access to nextcloud server with external domain

I’ve installed nextcloud on a home local network. It’s works OK, zorin os + apache + https. It works ok if I access under my local network.
I’ve created an ddns account for remote access.
If i write ip server on a web browser, i can access to server with out problems, but if I try to access with domain name instead ip, web site can’t load and too many redirects message is shown on chrome.
I’ve redirect 80, 443 ports to nextcloud server.

Please, any advice to solve this problem?
Thank you in advance

Have you set ‘Trusted Domains’ correctly in the config.php file?
You need to mention you host-domain as well, otherwise NC will not accept the requests.

  • What web server are you using (apache / nginx)?
  • Which version Nextcloud instance did you install (AIO / …)
  • Does Nextcloud has a self signed certificate or else?
  • Have you opened ports 80 and 443 on your router?
  • Have you forwared ports 80 and 443 to the correct internal IP address?

Have you set ‘Trusted Domains’ correctly in the config.php file?
yes. My setup works on local network and external access if i use ip but i can’t access using domain name.

You need to mention you host-domain as well, otherwise NC will not accept the requests.

  • What web server are you using (apache / nginx)?
    apache

  • Which version Nextcloud instance did you install (AIO / …)

I setup Nextcloud from scratch. Install apache2, mariadb, php

  • Does Nextcloud has a self signed certificate or else?
    selft signed

  • Have you opened ports 80 and 443 on your router?
    yes

  • Have you forwared ports 80 and 443 to the correct internal IP address?
    Yes

Thank you for the information. Now we have a bit more information about your setup, that helps the community to understand the cause of the problem you are facing.

I assume that the problem is with the self signed certificate. I assume that the common name is not including the FQDN (for example: nextcloud.your-domain.com).
This might be the reason why you experience many redirects when trying to connect to NC from the outside of the network.
Another fact is that self signed certificates are mainly used for test purposes or for use in internal networks.

I recommend using a Certificate issued by a trusted Certificate Authority. Let’s Encrypt is the best option I believe since it is free to generate and use for your web pages (like Nextcloud is in fact).

1 Like

Thank you for your advice!!

Finally, the problem is solved. There were two errors, certificate and bad configuration into nextcloud.conf and nextcloud-ssl.conf apache files.
I’ve installed a Let’s Encrypt certificate and repair config and server works like a charm

2 Likes