Quick Fix:
Run occ config:list from the /var/www/nextcloud directory on your server. You’ll get the current server URL right away. If it’s wrong, edit config.php and restart Apache or nginx.
What’s Happening
Nextcloud stores its hosting address in config.php. When that address is wrong—maybe after a router change, ISP switch, or domain move—clients can’t connect. You’ll see errors like “server not found” or “unable to connect.”
How do I find my Nextcloud server address?
occ config:list from your Nextcloud server’s /var/www/nextcloud directory.That command spits out your current server URL. Look for lines like overwritehost => 'cloud.example.com' or overwrite.cli.url => 'https://cloud.example.com'. If the address is wrong, you’ll need to update it in config.php.
Why isn’t my Nextcloud server address updating?
That’s why mobile apps and browsers keep failing even after you fix the server. Clear the app cache or reinstall Nextcloud on your device. Also check if DNS hasn’t propagated yet—give it a few hours.
Step-by-Step Solution
- SSH into your Nextcloud server as root or with
sudo:ssh admin@192.168.1.100
- Head straight to the config folder:
cd /var/www/nextcloud/config
- Pull up the current config to see the base URL:
sudo -u www-data php /var/www/nextcloud/occ config:list
Scan foroverwritehost => 'cloud.example.com'oroverwrite.cli.url => 'https://cloud.example.com'. - Open
config.phpin a text editor (I’m using nano here):sudo nano config.php
Find theoverwritehostandoverwriteprotocolkeys. Update them to match your new address, like this:'overwritehost' => 'cloud.example.com', 'overwriteprotocol' => 'https',
- Save your changes (Ctrl+O, Enter, then Ctrl+X in nano).
- Restart the web server to make those changes stick:
- Apache users:
sudo systemctl restart apache2
- Nginx users:
sudo systemctl restart nginx
- Apache users:
If This Didn’t Work
- DNS still acting up? Flush DNS on your devices:
- Windows machines:
ipconfig /flushdns
- macOS or Linux boxes:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- Windows machines:
- HTTPS errors won’t go away? Add the new certificate to your OS trust store. Or update the certificate in your reverse proxy (Traefik, Nginx, etc.).
- Mobile app still throwing tantrums? Wipe its cache or reinstall Nextcloud. Those apps remember the old URL like it’s their job.
Prevention Tips
- Centralize your URLs with environment variables in
config.php. Future edits become way easier. - Back up
config.phpevery week. Most breakages come from typos in this file. - Turn on
overwrite.cli.urlso CLI tools likeoccalways hit the right host. - Keep an eye on DNS TTL. Drop it to 300 seconds or lower 48 hours before moving domains—downtime shrinks dramatically.
Running Nextcloud on a residential ISP with a dynamic IP? Pair it with a dynamic DNS service like No-IP to dodge address drift. Honestly, this is the best way to keep things stable.
