So I am developing this site on my localhost and currently when I 'upload' a file, I have set the file to be stored in an uploads
folder, with sub-folders being generated consisting of the first 2 characters of the assigned file ID. For example, something like this:
/uploads/ab/abcde.mp4
Now that's nice and easy when I have the entire site on one machine/drive, but wanting to plan the site with scalability in mind, how would I plan for if I ever need to add extra storage to the site?
The sites would be hosted using Apache (probably) and Ubuntu. I have a few questions though:
For a single, let's say, 16GB RAM VPS, how much additional storage would it be likely you could add?
If additional drives are added, how would you point the server to that file? For example, let's say I have the following HTML:
<img src='uploads/aa/aaaaa.jpg'/> <-- this file is on one drive
<img src='uploads/bb/bbbbb.jpg'/> <-- this file is on another drive
On Windows, if you plug in any external device or whatever, it obviously appears as drive E:\
or something - is that also true if you add additional storage into a webserver? So that file A might be in uploads/...
, but file B would have to be saved in E:/uploads/...
?
I thought this could have been how it would work and then you'd use Apache/Nginx to perhaps map different urls to different drives - for example, the full urls could be http://d1.mysite.com/uploads/aa/aaaaa.jpg
and http://d2.mysite.com/uploads/bb/bbbbb.jpg
(note that the difference is "d1" and "d2") where, with Apache, you could have a rule in .htaccess to map the different incoming requests to different drives, based on the URL. I have tried searching for things like "Apache/.htacess map url/request to different drive" etc, but haven't been able to find anything, which leads me to think this isn't how you do it.
If someone could point me in the right direction, I'd really appreciate it