--- title: Backup di nextcloud sidebar: mydoc_sidebar summary: "mettere la sicuro i dati della comunità di tanto in tanto" permalink: mydoc_backup.html folder: mydoc --- # Backup https://docs.nextcloud.com/server/20/admin_manual/maintenance/backup.html To backup a Nextcloud installation there are four main things you need to retain: The config folder The data folder The theme folder The database ### Sul server connettersi al server tramite ssh ssh-add -D; ssh-add -i ~/.ssh/sshcampiaperti; ssh -vvv -p 2222 -l root campiaperti.tetaneutral.net impostare la modalità manutenzione docker exec -u www-data nextcloud-app php occ maintenance:mode --on backup di config, data, themes, and custom-apps #zip -r /home/backups_dispensa/data-nextcloud_$(date +%Y%m%d%H%M).zip /var/app backup del db docker exec -i nextcloud-mariadb mysqldump --single-transaction -u [username] -p[password] [db_name] > /home/backups_dispensa/nextcloud-sqlbkp_$(date +%Y%m%d%H%M).bak ### Sul proprio PC scaricare il backup del db scp -P 2222 -r root@campiaperti.tetaneutral.net:/home/backups_dispensa/nextcloud-sqlbkp_`date +"%Y%m%d"`.bak /home/$USER/ scaricare il backup di config, data, themes, and custom-apps scp -P 2222 -r root@campiaperti.tetaneutral.net:/home/backups_dispensa/nextcloud-app_1.tar /home/$USER/ --- #### Ripristinare configurazione di nginix "client_max_body_size" docker exec -ti nextcloud-proxy /bin/bash da dentro al container vi /etc/nginx/nginx.conf aggiungere la riga dentro a http {…} client_max_body_size 20M; riavviare ad nginx nginx -s reload --- #### Togliere la modalità manutenzione docker exec -u www-data nextcloud-app php occ maintenance:mode --off {% include links.html %}