I thought of making the title of this post “Turn EX2’s web server into your own simple site” but then it would miss the attention of many who would actually benefit from the idea and so rather than stating what this post will help you do, I decided to make the title about the benefit of doing it.
Please note this will require making one teeny-tiny (and very temporary) change to your EX2 via SSH, so if you are not comfortable with using ssh then this is not for you. But the change you will make is completely and automatically reversible, just by restarting your EX2…so it is not as “dangerous” as you might think Having said that, there are security dangers anytime you open up a server, expecially web servers, to the world - but at the same time, most common security threats against web servers like SQL injection, etc. have been dealt with by EX2’s built-in web server ligttpd. So it is not too risky - but you can be your own best judge. If you choose to proceed with the following steps, you will be assuming all liabilities, should something go wrong - including possible loss of warranty. Also, note that this functionality is obviously not supported by WD’s tech support staff. Okay, onto the good stuff.
Thing is I have never enabled Cloud Access on my EX2 in the 5 months I have had it. I did try it once but it gave me some unauthorized user error - and I had no inclination at the time to pursue it with tech support…since I was content in having my server be used for what I needed it for - an FTP/SFTP server and occasional network storage server. But in recent weeks of playing with Joomla and the web server made me realize, that what I was doing with the web server could easily help many folks who are often bemoaning on this forum the lack of the ability to share something with their friends using a simple http link. Now what I will share here will make any file you wish available to the whole wide world - there will be no privacy…but at the same time since only you will know the file name and no one from outside can see what files (and filenames) you are sharing, realistically the files are only going to be available to those you share the link with (and those that they share it with). Another thing to keep in mind - is that you will be manually building the URLs - so it is easy to do it for a small number of files - you CAN if you want also do it for a large number of files BUT the URLs will need to be generated by YOU…this is a manual (but simple) process.
What you really want to do are three things - but there will be potentially a few other related things to do to get everything working. The two things are:
- Create a share where you will put your web files
- Turn on web access from outside world
- Have EX2’s web server serve files in your share
1) Create a share to put your web files: It is as simple as creating the shares you already know how to create using the web dashboard - there are no special steps…just note that it is best to have a one word share name but if you must have two words, use an underscore ( _ ) and not a space for the share name. You may even want to create different shares for different types of files you want to share with - say shares called docs, pics, pdfs, videos, etc. Then setup write permissions to the share, just like you do with any shareensuring that at least your user (i.e. your username) can write to it. After creating the share, just drop the files you would like to share with your friends into that share - again, pleae note, there is technically no privacy or security - anyone who has the link that you give out can view the file.
2) Turn on web access from outside world: Go to your web dashboard → Settings → General → Cloud Access → Dashboard Cloud Access → set it to On. This makes the web server accessible from outside your home/office network. You do need to ensure that Internet traffic from outside your network can easily come through to the EX2. To do that - you will need to set up port forwarding on your router for port 80 (for regular http access) and port 443 (for https access). You will need to consult your router’s manual for that - that setup is beyond the scope of this guide. There is another alternate way to do this using UPnP settings on the EX2 - but I am not familiar with that - I have always relied on router port forwarding. BTW, the port forwarding works best if you assign a static IP on your router to EX2…so I would strongly encourage you to set that up first so that you never have to worry about it if your router reboots because of a power outage and loses the current internal IP address for EX2.
3) Have EX2’s web server serve files in your share: Please note that everytime your EX2 reboots - this step will need to be redone as this setting is lost after reboot. This is the step where you will need to SSH into your EX2.
-
First you will need to turn SSH access on from web dashboard → Settings → Network → Network Service → SSH → set to ON if not already on and click Configure to setup ssh password.
-
After that, from a Windows computer use the free tool called PuTTY (google to find download) and from a Mac use the built-in Terminal program to ssh into the EX2. Use the EX2’s internal network IP address (available from dashboard → Settings → Network → Network Profile → IPv4 IP Address).
-
After connecting to the EX2 via ssh, enter the following commands in succession (ignore any part in parenthesis - they are for notes):
cd /mnt/HD/HD_a2/
ls -la (verify that the directory/share you created is among the list that is displayed)
ln -s /mnt/HD/HD_a2/<share_name> /var/www/<your_share_name_or_another_name_of_your_choice> (replace the items in angled brackets with whatever name you gave to your share…and for the second name it can be the same or adifferent name of your choice EXCEPT web…plase note carefully this second directory name - as that will become part of your URL. If you created multiple shares, then make sure you do this step for each of those shares).
At this point you are all done with the setup. Couple other things you probably want to setup as well if you don’t want to give people URLs that are temporary in nature, like your external IP (can be obtained by googling what is my IP). You can get a DNS name for your IP using a dynamic DNS service. dyndns.org offers a free service but I personally prefer their paid service (make sure to not to auto-renew the service - you can always manually renew). You can basically get a dns name like johndoe.dyndns.org and assign it to your extrnal IP - and then setup EX2 to auto update that info should your external IP change (Dashboard Settings → Network → Network Service → Dynamic DNS → ON and Configure). Of course, this is purely optional - you can get it to work just by using your external IP.
NOW to share the URL of the file with friends/family, you need to manually build the URL. Also note that files you share is best to not have spaces in them - if they do, either change the filename to have underscores for spaces OR after you manualy build the URL, use an URL encoding tool (like the one here → http://meyerweb.com/eric/tools/dencoder and use the Encode button after pasting your manualy built URL).
To manually build the URL (link) join together the different parts below separated by plus sign (ensuring there is no space in the final URL):
http:// + external IP address or a dynamic DNS name + / + <second directory name from step 3’s final step above> + / + name of file you are sharing
OR
https:// + external IP address or a dynamic DNS name + / + <second directory name from step 3’s final step above> + / + name of file you are sharing
Try out the URL in your browser and then share it with your friends/family.
If this post helps you, please click on the star under my username on the left of this post to give me a kudo.