Share your files with friends using http links

Ice_2k wrote:

 

So basically, my questions are:

  1. Is there way to create a web server on the NAS without activating remote access to the NAS’s interface? I’m not really happy about opening up that door.
  1. Can I simply write a php script that receives let’s say a folder name as parameter, parses that folder and creates a media gallery from it? The problem is not writing the actual script, it’s that I don’t know if I can just add a php there and have it be interpreted.

 

A1. As far as I know, the only way to open the web server that’s built in to the firmware is to enable dashboard cloud access. I have realized that enabling that basically behind the scenes causes the Linux’s firewalls to allow requests from outside network. Normally this opening up of firewall would be done with the ifconfig command - but there is no way to do that using the firmware found in the Mirror/EX2/EX4’s firmware. But my experiments have revealed that when I enable the dashboard cloud access, suddenly my web requests from outside network reach the server…and thus it tells me that essentially that GUI option allows the Linux’s firewall to accept incoming requests.

Based on what you are trying to do, I believe this (i.e. enabling dashboard cloud access) would be your best option. You won’t actually be giving the folks a link to get to s specific folder but what would do is setup a share (folder) where you keep all these pics - and assuming you would like all the pics in the share to be visible to a group of folks, you would then create one user to represent that group of folks and grant that user read-privs on that folder. After this, make use of the Web File Viewer App feature of the Mirror (also on EX2/EX4) - this basically allows non-admin users to login to the NAS server via the web interface (same as you use to admin the device) but with only one option - the web file viewer app. And since the user have only been granted readacces to just one share (or more shares) they can ONLY see those folders. andgo in those folders and download the pics…or if you have granted write privs, then they can even upload files to you (or perhaps you could create a separate upload folder for them with write privs, if you so need, while you keep the pics folder read-only from which they can download all the files). Check out the Web File Viewer app yourself by logging in as admin onto the dashboard - Apps → Web File Viewer. And after you have setup the share and permissions for the user(s) you can check it out yourself by logging in as them. This feature was broken until the latest firmware relase - where only the admin could use this, but finally now non-admin users too can see the folders to which they have been granted access. But for this to work from outside you will need to enable dashboard cloud access. I think this would be closest to what you are looking for.

A2. PHP is already installed on the server. If you are comfy with PHP scripting (I only have dabbled in it and know very little) you can login via SSH, create the simplest phpinfo script (Google if you don’t know how) and toss that script into the /var/www/ directory and then from browser browse to http://<internal_IP_of_Mirror/EX2/EX4>/phpinfo.php. You will learn about all the server’s installed PHP details you need to know. And for this to work you don’t need to enable dashboard cloud access obviously. But if you are looking to enable outside access to the built-in web server, you do need to enable that, as explained in Answer1 above.

I understand the queasiness of opening up the server - but Apache is pretty secure (though sadly they are using a very  dated version of Apache in the latest firmware). As long as you don’t install MyPhpAdmin app I think you’ll be fine (after enabling logging on my EX2’s web server, I see constant probes to get to MyPhpAdmin app - that seems to be THE MOST common probing attempt by far for port 80). Trust me, I have opened opened SSH access to the otuside world (as well as port 80) and the server is constantly getting hammered but it has not been breached yet in the nearly 7+ months that I have opened access. I have only about a month ago implemented logging for port 22 and have started blocking IP ranges in the firewall of my router based on the  IPs logged.

Additional Info: I believe WD’s mobile apps does present galleries of pics (I haven’t used them so can’t comment more), but if you are looking for a computer browser-based gallery presentation of pics you put in a share, then that’s going to require some extra work and some duplicated files. The only way I can think of having a pic gallery is by using a content management system like Joomla or WordPress. Both are available as 3rd-party apps from the dashboard (search for some Joomla-related posts from me in this EX2 sub-forum). I have not toyedwith WordPress but have with Joomla and for creating an image gallery there are plenty of free joomla extensions, etc. (available from joomla.org) to setup simple picture galleries. But yes, you will have to manually create upload the pics into joomla’s image subdirectory so having them in another share won[t be ofany use. That is the only way I can think of having a web-based pic gallery.

If this info helps you, please click the star under my username to the left of this post to give me a kudo.

1 Like