virtual directories in webserver

Got problems with Bubba? Then this forum is for you.
Locked
kaosmagix
Posts: 4
Joined: 23 Sep 2007, 14:13

virtual directories in webserver

Post by kaosmagix » 23 Sep 2007, 14:36

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

tor
Posts: 703
Joined: 06 Dec 2006, 12:24
Contact:

Post by tor » 24 Sep 2007, 04:19

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
Co-founder OpenProducts and Ex Excito Developer

GaryL
Posts: 87
Joined: 04 Sep 2007, 17:40
Location: Northern Ireland

Post by GaryL » 24 Sep 2007, 05:38

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?

estorino
Posts: 26
Joined: 25 Aug 2007, 06:44
Location: Utrecht, The Netherlands

Post by estorino » 24 Sep 2007, 06:41

You could password protect it by using the good old .htaccess trick...

kaosmagix
Posts: 4
Joined: 23 Sep 2007, 14:13

Post by kaosmagix » 24 Sep 2007, 14:35

Thanks this works :D!!!

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

GaryL
Posts: 87
Joined: 04 Sep 2007, 17:40
Location: Northern Ireland

Post by GaryL » 28 Sep 2007, 16:39

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

tor
Posts: 703
Joined: 06 Dec 2006, 12:24
Contact:

Post by tor » 29 Sep 2007, 08:19

Looks ok what i can see. You can read more on this here http://httpd.apache.org/docs/2.0/howto/auth.html

/Tor
Co-founder OpenProducts and Ex Excito Developer

Locked