Public IP showes up in config.php

Hi, i did just install nextcloudpi on my Pi4.
And really happy, but in the /var/www/nextcloud/config/config.php file it always puts my public ip in there automaticly. I dont want my Nextcloud to be avalible via just the IP.
When i remove the IP from the config.php, it will show up again, after a reboot. Has anyone a tip for me?

Nextcloud Trusted Domains is what you use to define a domain instead of an IP. You’ll want to consult admin documentation to learn more. :+1:

Hi, yeah the ip is in the trusted domains, but id like it gone (for good). I want my nextcloud (from outeside) only be accecible via the Domain. When taking the Public Ip out of trusted domains, it always will be back after a restart…

I did read the trusted domain part of the admi documentaion, but it does not apply to my problme (or at least the ip should not be back in the list, after i remove it and restart the Pi).

Probably some weird script in this “nextcloudpi” thing you’re using. As an alternative to cutting it out of the nextcloud config.php would be to control the access from the webserver. Set up your virtual host so that it only responds to the domain name and not the raw ip address.

1 Like

I like that Idea. Thank you, will do that!

Have been trying to do that, but haven´t been abel to find a proper link that showes me how to do it. Can you send me a link. I am running Nextcloud on a Raspbeery Pi 4 with apache2 as a server.

Well basically, you need to create an additional catch-all virtual host that is brought into the config before the main virtual host that is serving your NC instance.

So for example;

#Catch-all / default VHost
<VirtualHost *:443>
    ServerName default
    # Do something here with the default

# Nextcloud VHost
<VirtualHost *:443>
    ServerName nextcloud.mydomain.tld
    # blah blah blah

So basically what will happen is that any request coming in for ServerName NOT equal to “nextcloud.mydomain.tld” will get served by the first VHost.