How do install and configure Nextcloud properly

TLDR: I just wanna know how to properly configure Nextcloud + expose it for Port Forwarding.

I’ve tried to Configure Nextcloud for the past few hours now. I followed Nextcloud | TrueNAS Documentation Hub, which seemed to work fine.
I then went in the Nextcloud Web Portal to Settings → “Security & setup warnings”
It has/had the following Errors:

  • Your data directory and files are probably accessible from the Internet. The .htaccess file is not working. It is strongly recommended that you configure your web server so that the data directory is no longer accessible, or move the data directory outside the web server document root.
  • Some files have not passed the integrity check. [List of invalid files…][Rescan…] For more details see the [documentation :arrow_upper_right:].
  • Your web server is not properly set up to resolve .well-known URLs, failed on: /.well-known/caldav For more details see the [documentation :arrow_upper_right:]
  • The database is missing some indexes. Due to the fact that adding indexes on big tables could take some time they were not added automatically. By running “occ db:add-missing-indices” those missing indexes could be added manually while the instance keeps running. Once the indexes are added queries to those tables are usually much faster. Missing optional index “fs_storage_path_prefix” in table “filecache”.
  1. I fixed this by moving files from /var/www/html/data to /var/nextcloud_data/, changing Applications > Installed > Edit nextcloud > Nextcloud data directory to /var/nextcloud_data/, changing 'datadirectory' => '/var/www/html/data', to 'datadirectory' => '/var/nextcloud_data', in config.php and adding location ~ ^/var/nextcloud_data { deny all; } to /etc/nginx/nginx.conf
    I have no clue if this is correct.
  2. Maybe some kind of permission Issue.
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix

- core
		- nextcloud-init-sync.lock

Raw output
    [core] => Array
            [EXTRA_FILE] => Array
                    [nextcloud-init-sync.lock] => Array
                            [expected] => 
                            [current] => 



  1. People recommended sudo -u www-data php occ db:add-missing-indices, but there is no php, so I found suggestions like Using the Nextcloud Shell: Applications > Installed > Nextcloud > Containers > > Shell, but I was unsure which command to run in there. Also people suggested a cron job, so php would work, but I have no clue how to do that either.
  2. I still have no clue how to make Nextcloud listen to Port 9001 when I use my IPV6 to connect to it https://[IPV6]:9001. I know the Port is forwarded, because I get ERR_CONNECTION_REFUSED, which means no App is listening.

I’d appreciate any help. Please ask if something isn’t clear. I am open for any ideas.