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
them.

Results
=======
- core
	- EXTRA_FILE
		- nextcloud-init-sync.lock

Raw output
==========
Array
(
    [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 > docker.io/library/nextcloud:29.0.1 > 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.

facing exact same issue, I’ll try to change datadirectory as you said but what about these:

array (
0 =>
array (
‘path’ => ‘/var/www/html/apps’,
‘url’ => ‘/apps’,
‘writable’ => false,
),
1 =>
array (
‘path’ => ‘/var/www/html/custom_apps’,
‘url’ => ‘/custom_apps’,
‘writable’ => true,
),
),

1 Like

Hello,

Does anyone already have a solution for below, as mentioned in initial question?

Some files have not passed the integrity check | code
Technical information
=====================
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
them.

Results
=======
- core
	- EXTRA_FILE
		- nextcloud-init-sync.lock

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

                )

        )

)

My knowledge using commands and deep programming stuff is not that good, atleast not yet. So maybe someone can makes things a little visual and write down a try from A-Z.

Thanks :smiley:

Best regards
Philomath

1 Like

Hello,

Regarding this error again

Some files have not passed the integrity check.
Related file: nextcloud-init-sync.lock
Empty file.

So, after some research I have removed the whole file. The error after rescan was gone. So it looks alright now.

For my understanding the official NextCloud documentation tells me, when the file is part of an “EXTRA_FILE” it must be removed.

nextcloud-init-sync.lock

By the way, 50% file searching / editing I use the TrueNAS app called File Browser. Just a bit easier than writing everything out in the shell.

2024-07-25_20-52-07

Best regards
Philomath

1 Like

Probably indicates a crash/abort during init thus leaving a lock file behind.

1 Like