Best practices for which directory to host from, backups?
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
Media is more however you want to do it. A slightly more appropriate directory might be /usr/share/
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.
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 .