Page 1 of 1

virtual directories in webserver

Posted: 23 Sep 2007, 14:36
by kaosmagix
Hi,

I'm a fresh Bubba owner with little to no knowledge of linux/apache.

I like to use Andromeda (a PHP mediacollection/streaming site) This works when I put the medifiles directly in the /home/web/andromeda folder, but I want to use the regular /home/storage/music folder for this so I can use the same folders with uPNP as well. To get this to work I have to create a virtual directory (symbolic link) so that http://bubba/andromeda points to /home/storage/music. How can I do this?

Thanks in advance, cris

Posted: 24 Sep 2007, 04:19
by tor
Hi kaosmagix,

Let me start by issueing a warning. If your Bubba webserver is exposed in a "public" environment one should think twice on what is published on it and what implications that might have.

That said a symlink would most likely work. Log in to a shell in your Bubba and do the following:

Code: Select all

ln -s /home/storage/music /home/web/mymusic
and the music foilder should be accessable as http://bubba/mymusic

The more "correct way" of doing this is by adding an alias to apache. The way to do that is by logging in as root to bubba. Create a new file, lets call it music, in /etc/apache2/conf.d that looks something like this.

Code: Select all

Alias /mymusic /home/storage/music 
<Directory "/home/storage/music">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Allow from all
</Directory>
and then reload apache config by

Code: Select all

/etc/init.d/apache2 reload
/Tor

Posted: 24 Sep 2007, 05:38
by GaryL
If you do this, would it be possible to password protect the linked music folder when accessing http://bubba/mymusic via www with out effecting the samba share?

Posted: 24 Sep 2007, 06:41
by estorino
You could password protect it by using the good old .htaccess trick...

Posted: 24 Sep 2007, 14:35
by kaosmagix
Thanks this works :D!!!

At this moment security isn't an issue, but in the future it could be.

Posted: 28 Sep 2007, 16:39
by GaryL
I've set up my music folder so that its password protected, it asks for user name and password so seems to work.
But does it look ok?

This is in file "/etc/apache2/conf.d/music"

Code: Select all

Alias /mymusic /home/storage/music
<Directory "/home/storage/music">
        Options Indexes MultiViews FollowSymLinks
        AuthType Basic
        AuthName "Restricted files"
        AuthUserFile /etc/apache2/htpasswds/.htpasswd
        Require user mymusic
</Directory>
[edit] created authuserfile by issueing the command:
# htpasswd -c /etc/apache2/htpasswds/.htpasswd mymusic

Posted: 29 Sep 2007, 08:19
by tor
Looks ok what i can see. You can read more on this here http://httpd.apache.org/docs/2.0/howto/auth.html

/Tor