[Guide] HTTP Directory Navigation of file shares

This is a very simple guide, but if you not familiar with bash, ssh, apache do not try it,

you can stuff up your apache web server and make your WD UI Gui service unavailable if your unsure. 

I accept no responsibility of damage to your hardware or software setup, this will void your warrenty etc blah blah blah. 

This guide will allow you to add directory navigation of your file shares and downloading of your files.

Note, this will by pass all samba file share security you have already configured. 

First thing, log into ssh, then navigate to Apache configs directory which is /etc/apache2/sites-enabled

cd /etc/apache2/sites-enabled

In this directory you can add your own apache conf files which will be included when apache is restarted. 

We will create a new conf file here to allow us to navigate our files within a web browser (use you faviourite editor nano or vi).

vi myshares.conf

or

nano myshares.conf

when the editor loads up, add the following text:

Alias /Shares /DataVolume/shares

<Directory /DataVolume/shares>

   ${LOCAL_NET}
Options +Indexes
</Directory>

save your changes

note,   ${LOCAL_NET}  this setting prevents external network from viewing this /Shares

and test out the change by restarting apache

/etc/init.d/apache2 restart

if you get an error, fix any spelling mistakes in myshares.conf file and issue the above apache restart command again.

If you want to revert back to the default, just delete myshares.conf files and restart apache2.

# Delete config and revert back to default

cd /etc/apache2/sites-enabled

rm myshares.conf 

 

 

To test you new web directory, use the follow url.

http://<your nas ip address/dns name>/Shares

e.g

http://192.168.1.2/Shares

1 Like

Nice guide, I always wanted this kind of functionality!

Is it possible to add a username/password authentication to this?

Short answer is yes. You can create .htaccess files in the directories you want restricted navigation, require user authentication, or even execute a CGI program.

refer here for more information :  http://www.askapache.com/htaccess/ultimate-htaccess-file-sample.html#AUTHENTICATION_SECURITY

1 Like

Ofcourse, I totally forgot about .htaccess files…

Thanks for the reply!