Question

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

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?


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

@aljuaid86

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.

@aljuaid86

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:

/etc/apache2/sites-available

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

/etc/nginx/sites-available

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.