Skip to main content

Nextcloud

Manually adding files

It is possible to add files directly in the server, by transfering them in the Nextcloud's app volume. The volumes are located under /var/lib/docker/volumes, and the files are in the data/__groupfolders/1/ subfolder of the volume.

To correctly add the files, you may need to convert the filename encoding, the easiest being using rsync. For example: rsync -ahr --info=progress2 --iconv=ISO-8859-1,utf8 /var/gdrive/03_Événementiel/ /var/lib/docker/volumes/nextcloud_nextcloud-app/_data/data/__groupfolders/1/GDrive/03_Événementiel/.

Once added, you first need to update the files ownership to www-data with chmod www-data:www-data <FOLDER> -R. Then index them in Nextcloud for them to be available in the web application. To do so, run the command php ./occ files:scan --all from the /var/www/html directory as the user www-data within the Nextcloud's container. The easy way is to get the container's name using docker ps, then run docker exec -it -u www-data <CONTAINER> php ./occ files:scan --all. This may take a while, so I recommend to use screen to start it in background, such that you can close the connexion without stopping the indexing.

Fixing index.php

After restarting nextcloud, it may happen that the base path of the installation become /nextcloud/index.php. In that case, you should run the command php occ maintenance:update:htaccess in the nextcloud container when logged in as www-data, thus usually something like docker exec -u www-data nextcloud_nextcloud.<smth> php occ maintenance:update:htaccess should be sufficient.