For my intranet-only nextcloud installation, I have generated a self-signed certificate:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nextcloud.key -out /etc/nginx/ssl/nextcloud.crt
I'm running ubports 16.04 stable on a nexus 5.
Accounts -> Nextcloud won't accept the internal IP in the form https://192.168.2.300
.
The error message is: host URI invalid
.
I can access the web interface using the morph browser after confirming to use the untrusted connection.
First you need to make the relevant paths (temporarily) writable.
Otherwise you will end up with the error message mkdir: cannot create directory ‘/etc/ca-certificates/extra’: Read-only file system
.
Either remount everything rw, as adviced here: sudo mount -o remount,rw /
and reboot as soon as you're done and want get read only protection back.
Or sudo touch /userdata/.writable_image && sudo reboot
(to restore read only mode, sudo rm /userdata/.writable_image
.
Login to your phone terminal (either via terminal app, via adb or via ssh.
Fetch the *.crt file from your nextcloud server (e.g. scp user@192.168.2.300:/etc/nginx/ssl/nextcloud.crt ./
).
$ sudo mkdir /usr/share/ca-certificates/extra
$ sudo cp nextcloud.crt /usr/share/ca-certificates/extra/
$ dpkg-reconfigure ca-certificates
# In the following dialog choose "ask" and select your new certificate after proceeding
$ sudo update-ca-certificates
$ sudo reboot
The error message host URI invalid
will not appear anymore when adding your Nextcloud Account.
These articles have also been helpful: