As mentioned you can use a plugin to do this that will make backups
to a directory or sftp location.
I don't really like using a plugin to do this, so I use rsnapshot to backup my MySQL database and specified directories (including wordpress).
- Rsnapshot is way to complicated to give you instructions in a post, so I would google Synology NAS Rsnapshot for details about your NAS setup to acheive this.
- I am not sure what OS you are using, but I have tutorial on how to backup my Server to my desktop using Ubuntu on both. This should help get you in the right direction if you want to use Rsnapshot. Here is my guide
- You can use a plugin to backup your mysql database or setup crontab.
In order for you to backup your wordpress MySQL database the way I did you must have a
.my.conf file under /home/user/ with the username and password of a mysql user that has the following access
select, lock tables, show view, trigger, and events (may or may not need trigger/events).
Here is my cron job for my wordpress MySQL Database which runs twice a day (I have a full dump as well):
20 0,12 * * * /home/user/.scripts/mysql/wp.sh
Here is my script that it calls:
mysqldump wp | gzip -9 > /home/user/.backups/mysql/wp-$( date '+%Y-%m-%d_%H-%M-%S'
I hope this helps get you in the right direction. Their is probably a better way to backup your MySQL to a file, but I set this up on someone's shared hosting, so I was limited on what I could and could not do. The drawback to dumping MySQL is that it locks the the database while dumping it to a file in order to not corrupt things. This means that your site may be inaccessible for a second or two during this time.