1

Disclaimer: I know my way around Linux, but I'm out of the loop for a while.

I have a CentOS 7 server where I host a couple of my small websites in /var/www/website1, /var/www/website2 and so on. Now I want to add one more website which will have big files. I started uploading stuff and got a "out of disk space" message. When I run df -h I get below output:

[root@ns304241 kosa]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        20G   19G  4.7M 100% /
devtmpfs        7.8G     0  7.8G   0% /dev
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           7.8G  885M  7.0G  12% /run
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/md3        1.8T   48G  1.7T   3% /home
tmpfs           1.6G     0  1.6G   0% /run/user/1000

Notice that my /home directory is 1.8T while /var/www is, I assume on /dev/root device, which is only 20G.
I was under an impression that websites should be hosted in /var/www for the simple reason of having multiple users access to the website files and peace of mind with permissions against hosting websites in /home.

  1. Is my system set up in some weird way? Shouldn't /var be on the big (1.8T) drive, as all the logs are there and can easily take up a lot of space?
  2. Should I move my websites to /home?
  3. But what if I need two different users to access the same website files?
  4. What's the best approach?

2 Answers 2

1

I would recommend symlinking your websites from a directory on the larger drive. That's what I do since all my actual site data is on a drive that gets backed up.

ln -s /actual/path/to/file /var/www/website3
3
  • with the symlink done, should the root directive in nginx still point to /var/www/site1 or /home/user/site1 ?
    – 6bytes
    Sep 29, 2019 at 13:24
  • If you want to keep everything pointed at the /var/www for your config then you can leave it pointed there. With the symbolic link setup the directories can be referenced as normal. Sep 29, 2019 at 13:50
  • just got it working with a symlink, thank you :)
    – 6bytes
    Sep 29, 2019 at 14:07
0

If this is a company setup I would set this server up again, I would make it so that /var indeed has all the storage. You can do that on the setup. Is this just one big drive? If its multiple I'd use lvm setup.

1
  • It's a dedicated server with a preconfigured system. I don't think I have an option to repartition it.
    – 6bytes
    Sep 29, 2019 at 19:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .