Best practices for which directory to host from, backups?

I've been hosting virtually everything out of /var/sites/ on my Ubuntu server, but I was wondering if there was a more standard directory for hosting from.

Also, if I upload media to my server, is it best practice to put that in the same folder as my other hosted files or in perhaps /home/user/ ?

Secondly, I'm trying to set weekly backups on my machine. Are there any folders I don't need to backup or would you recommend backing up the entire server, kernel and all? Also, what backup solution do you recommend?

5 Replies

To FHS Standards: /srv/ is supposed to be for externally sourcing services (ie ftp, http, etc) but Linux is about choice, so do as you wish, or to your distro standards.

Media is more however you want to do it. A slightly more appropriate directory might be /usr/share/, but again however you really want to do it.

For backups:

  • no need to back up /dev/, /tmp/, /mnt/, /proc/, /lost+found/, /boot/

  • backups are for data, mostly. Although it does make it kinda easy to start finnix, and drop everything in after a linode install, and be up and running as you were before whatever struck.

** please note to take with a grain of salt, it is just how I do things on my server. Linux is about choice on everything. Do as you want, although many things can make sense in many different ways.

This may be naive, but I just serve everything out of /home. I came from DreamHost, so I just adopted their storage style of /home/username/domain.com. Makes it really easy for backups.

I use /var/www/domain/www with lighttpd's "simple vhost" module. I think as long as it's consistent for your install, do what you feel is best.

My tendency would be one of:

1. If I'm hosting one or more sites, but adminning them myself, a structure under /srv for the pages, media, and DB files (if any).

2. If I providing hosting to joe the user, I'd set them up under /home/joe.

I wouldn't mess around under /usr, since most package systems assume they own it (which is why I don't like /var/www, either). Of course, /usr/local/* is yours.

If you're uploading media via the webserver (like a picture gallery, or user forum icons, or some such), it should definitely be in its own directory, with appropriate permissions.

For backups, I don't backup stuff that I can re-install with apt-get. I do backup configuration files, though (all of /etc, basically). One important bit to backup is the list of installed packages; in a Debian based system, get /var/backups for several good things. Actually, /var is tricky, there's lots of big things you don't need backed up, ususally, but picking and choosing is a pain. For example, you might not want /var/log, depending on how you feel about log files, and /var/cache, which by definition can be rebuilt. Since I don't put any local stuff under /usr, I don't back it up.

@jpeddicord:

This may be naive, but I just serve everything out of /home. I came from DreamHost, so I just adopted their storage style of /home/username/domain.com.

That could get really sexy if you do apache forking by hosting under different UID/GID for each domain respectively .

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct