Say I have a NAS on the local network, which provides files via local Samba network shares, but is also accessible from the public internet over VPN. Say that I've also bought a simple web hotel hosting, with a public Internet server with a domain name.
I would like to be able to specify a list of specific directories on this NAS (presumably, in a text file stored on this NAS), that I'd like to share on the public Internet. Then, I'd want to set up a read-only VPN account on the NAS, intended specifically for the web server.
Finally, I'd like to set up a web application on the public server, which will
- authenticate on the local network over VPN as the read-only user
- read the file with the list of directories
- run through all of the directories in the list on the local network share, and generate a listing/tree of files and subfolders in them
- Show the listings/trees of files and directories as a webpage/website - and allow for download of the files
- Ideally, I'd like to be able to specify, say, 100 MB on the public website host as a cache; so if a file is requested from the public internet, it is served from the cache if it is found there - otherwise it is downloaded into the cache, unless the requested file is bigger than the cache (in which case the bytes downloaded from the local network file are directly sent to the public Internet user that requested the file). Upon a request of a file not present in the cache, if the cache is full, the oldest entries therein should be deleted.
- Even more ideally, if a file requested is an image or text or video or audio file, it would be either rendered in the browser accordingly, or downloaded, as requested
Do web applications exist that can do this? I'm especially interested in PHP and/or JS implementations - something that I could run on a cheapo web hotel; but I'd love to hear about other implementations too ...