I was looking to do exactly the same thing, although I'm self-hosting on an Odroid, but this simply cannot be done. The way to enable Pretty URLs looks like this.
First you need to edit your config.php
and add these values:
'overwrite.cli.url' => 'https://example.org/',
'htaccess.RewriteBase' => '/',
Then you can run the following from the command line (as per the Ubuntu snap):
$ sudo nextcloud.occ maintenance:update:htaccess
Snaps, by design, are read-only so you cannot edit any files in the snap container. The .htaccess
file that enables pretty URLs resides in ${SNAP}/htdocs/.htaccess
which on my machine is /snap/nextcloud/current/htdocs/.htaccess
. As a result, running the maintenance:update:htaccess
fails as the Nextcloud CLI cannot update a read-only file.
This issue with the Snap container has existed since 2016 and even as recent as 10 days ago there is no solution or will to fix this.
The lack of fix is because this isn't broken by design. Nextcloud don't enable Pretty URLs by default and the Snap maintainers don't want to enable something Nextcloud don't enable themselves in their Snap.
While I really want pretty URLs, I cannot fault the logic. I am not sure the hack to overcome this warrants the effort.