Nextcloud Connection Wizard - ERR_CONNECTION_REFUSED


I did my first install of Nextcloud server today using the Snap installation method on Ubuntu 18.04. I configured the server to use its own subdomain with a certificate from LetsEncrypt and everything is working fine when accessed in the browser.

The only slightly non-standard thing about my configuration is that I’m using nginx as a proxy to split requests (based on domain) between different web servers (The Nextcloud Apache server being one) running on different ports. So nginx was configured to forward requests to Apache and then I used certbot to automatically configure nginx with my SSL certificate. And as I said, everything loads fine in web browsers on multiple desktop machines.

The problem I’m having is that the desktop client (on both Mac and Linux) is failing to log in to my server.


  • Start new account wizard
  • Enter server address
  • Click “Next”
  • (login flow web interface loads successfully from server)
  • Click “Log in”


  • Prompted for login by server


This site can’t be reached

localhost refused to connect


It looks like the wizard has for some reason tried to load a page from localhost for this step rather than my server’s domain.

What am I doing wrong?


Update: Same problem on Android app.

Upon further research I’ve reached the conclusion that Nextcloud is failing to automatically detect its hostname and so was generating URLs using localhost. I’ve managed to fix this by manually overriding the host and protocol.

$ sudo nextcloud.occ config:system:set overwritehost --value=""
$ nextcloud.occ config:system:set overwriteprotocol --value="https"

Unfortunately a side effect of this is that I can no longer use Nextcloud using its local IP address or hostname (e.g. if the Internet goes down) because it always redirects to the public domain.

1 Like

this was ver ver helpful!!!