What files should I backup

February 24, 2015 2.3k views


I am new to digital ocean and I am configuring Duplicity to handle backups and store them offsite.

I am wondering if anyone can advise what files should be backed-up and what files should/can be left out.

My server is used to host websites for clients so I am planning to to backup all files within the /var folder and all mysql databases. Should I be concerned with backing up other system folders?

Thanks for the help.

1 Answer

If you are using apache for your virtualhosts I would also recommend backing up /etc/apache2. This will allow you to save your web server configuration as well. With that, your web root, and your databases you should be all set.

  • Hi, thanks for the reply.

    I am using apache so will include /etc/apache2 as you suggested.

    In the past, I have thought if the server was corrupted and I had to start again, I would be best to install and configure everything from scratch - then restore my web root and db's. However, based on what you have suggested regarding the apache2 folder - would I be able to install the LAMP stack and simply restore the apache2 contents over the top? Would this restore everything as I had it previously?

    Sorry for the basic questions - I don't have a lot of experience with the finer details of server maintenance. I am in the process of learning and picking it up so any help or advice you offer is great!


  • This depends on your configuration to some degree. If you are using a stock Apache setup and have just set up virtualhosts you can simply backup the /etc/apache2/sites-enabled folder. This contains the definitions (domain, web root, any custom configuration settings) for each site so when you get ready to restore you could:

    1.) Set up your new server and install the LAMP stack:

    apt-get update
    apt-get install apache2 php5-mysql

    2.) Copy over your /var/www directory (i assume your sites are stored in sub-folders here)

    3.) Create your MySQL databases and import your backups

    4.) Copy over your /etc/apache2/sites-enabled directory

    5.) Restart apache

    service apache2 restart
  • Yes that sounds perfect for my current set up and the way I am using the server.

    Thanks for the help and quick responses!

Have another answer? Share your knowledge.