[noob question] does the directory var/www/websitename holds all website files and data?

March 24, 2017 448 views

I'm facing huge issue and I need to do an emergency backup which is only can be done through ftp (and ssh also,,, I think) so if I downloaded all the files in the directory var/www/websitename will that make me with a safe backup? and I can start destroying everything to fix my issues? or my website is not in that directory?

2 Answers


The main location of your websites' data is defined by your VirtualHost or Server Block, depending on whether you're using Apache or NGINX. Apache uses VirtualHosts whereas NGINX uses Server Blocks.

For Apache, you'd want to look at the file(s) here:


For NGINX, you'd want to look at the file(s) here:


Find the files that are associated with your website(s) and open each file. Within each file you should see DocumentRoot (Apache) or root (NGINX). That's the base location of where your files should reside, so you'll want to backup those directories/files.

Additionally, if there files uploaded elsewhere, you'll want to back those up too.

Keep in mind, those doesn't backup databases, so if you need to backup MySQL databases too, you'd need to use the CLI or use phpMyAdmin to do so.

  • I've found /etc/apache2/sites-available but the files was around 1 mb only ! where in var/www/websitename I was able to download 2 GB,,, any ideas what is going on? fyi my website is php based. either way thanks a million for replaying


The file pertaining to your site in /etc/apache2/sites-available was simply meant to find the location of your files using DocumentRoot as the source (since that's where you're telling Apache that your files are).

To backup just your files, you need to backup files/directories inside of the DocumentRoot path as that's where your files are.

As noted in my previous response though, that doesn't include databases. You'd need to use either the CLI or a PHP script such as phpMyAdmin and Adminer to backup databases.

Have another answer? Share your knowledge.