-3

I have a server having two drives each of 2TB. First drive is mounted to "root" (which is called "/") and the second drive is mounted to /mnt/disk1. I am serving my files from first hard drive at location /usr/share/nginx/html/downloads/ with this default configuration below:

server { listen 80 default_server; listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/html;   <---------------default served file location
index index.html index.htm;
server_name localhost;

location / {
    try_files $uri $uri/ =404;      
    }    

}

My files can be downloaded at http://ip_address/downloads/softwares/example.exe

Now my first 2TB hard drive is filled and i dont have budget to buy another server. But i have another 2TB of hard drive having all of its 2TBfree space mounted at /mnt/disk1.

Can you please tell me how can i tell nginx to include that 2TB drive so that i can put and serve files from this 2TB drive at location /mnt/disk1

Ibrar
  • 3
  • 1

1 Answers1

0

Create a directory within the /usr/share/nginx/html/ directory and mount the drive from /mnt/disk1 to that new directory. Remember to unmount it from /mnt/disk1 first.

There are many other options but this is probably one of the quickest.

Make sure you put the mount point in your /etc/fstab otherwise it wont be there after boot and the content will disappear till remounted manually.

Payload
  • 266
  • 2
  • 7
  • Thank you so much. I am trying to do it... i seems that your idea would work. let me check :) – Ibrar Sep 19 '16 at 18:28
  • Sir i did something wrong. I mounted /dev/sdb2 to /usr/share/nginx/html/ which was previously mounted to /mnt/disk1. But now i cannot find 1.8 TB of files that were in /usr/share/nginx/html/uploads folder. When i go to /usr/share/nginx/html folder, i only found lost+found – Ibrar Sep 20 '16 at 12:05
  • Just un-mount the /mnt/disk1 and create a new directory under the html directory and mount it to that - the rest of the files will re-appear once the disk1 is un-mounted – Payload Sep 22 '16 at 22:23
  • ok i am gona try that.... And will let you know if that worked.... – Ibrar Sep 26 '16 at 06:39