Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: How can I use data outside of Apache root directory? |
|
Author |
|
Ency
Joined: 02 Jan 2014 Posts: 4 Location: Romania, Cluj
|
Posted: Thu 02 Jan '14 14:11 Post subject: How can I use data outside of Apache root directory? |
|
|
I have home a server Apache. I want to put all my party songs in one partition and can listen from anywhere without having to take CDs.
I have my site in C:\Site and the songs I put it in D:\Songs.
In php I see the D:\Songs directory, I can read subdirectories, I see the .mp3 and .Wav files, I created the playlist, but the audio player doesn't start.
If I move the songs files in C:\Site or C:\Site\Songs goes perfectly, I can listen my music, but I do not want to be there.
Why I see in D:\Songs, but does not want to go? In httpd.conf I have:
DocumentRoot "C:/Site/"
<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
and
<Directory "C:/Site/">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
I try to put also:
<Directory "D:/Songs/">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
bud does not work. "What Can I Do"?
http://www.youtube.com/watch?v=0r3xvd-dloU |
|
Back to top |
|
Steffen Moderator
Joined: 15 Oct 2005 Posts: 3092 Location: Hilversum, NL, EU
|
Posted: Thu 02 Jan '14 14:44 Post subject: |
|
|
Try somewhere in your httpd.conf:
Alias /songs "D:/Songs/"
You can remove the <Directory "C:/Site/"> and <Directory "D:/Songs/"> containers. |
|
Back to top |
|
Ency
Joined: 02 Jan 2014 Posts: 4 Location: Romania, Cluj
|
Posted: Thu 02 Jan '14 17:47 Post subject: |
|
|
Thank you, bud I try, bud does not work.
If I insert in httpd.conf
Alias /muzica "D:/Songs/"
I receive the error
<
Not Found
The requested URL /download/index.php was not found on this server.
>
after
http://www.mysite.ro/muzica/index.php |
|
Back to top |
|
Anaksunaman
Joined: 19 Dec 2013 Posts: 54
|
Posted: Thu 02 Jan '14 22:14 Post subject: Creating a Symbolic Link in Apache |
|
|
For the above, make sure that mod_alias is enabled in httpd.conf. However, if this doesn't work, likely due to permission issues, I would suggest a symbolic link (http://en.wikipedia.org/wiki/Symbolic_link).
What you do is essentially make the /muzica directory under your site and then tie it to D:/Songs with a symbolic link. This makes it so that it looks like you are interacting with /muzica on the server level (including allowing Apache to access a folder it looks like it owns but not really), but you are in reality working with D:/Songs any time you click on /muzica. /muzica becomes a shorcut to D:/Songs.
To clarify, here are the steps:
1.) Create the /muzica folder under the root directory for the server e.g "C:/Sites/muzica" (assuming C:/Sites/ is your website's root folder).
2.) In Windows, create a symbolic link between the C:/Sites/muzica folder and D:/Songs. You can reference this articles for doing from the command line in Windows:
http://www.howtogeek.com/howto/windows-vista/using-symlinks-in-windows-vista/
However, I would suggest Link Shell Extension if you don't want to mess with the CLI. It creates the ability to make symbolic links in Windows using the right-click menu:
Link Shell Extension 3.7.5
http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html#download
Link Shell Extension 3.7.5 Download
http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html#download
Make sure to get the proper binary for your Windows version (x32/x64) and install the few per-requisite redistributable before hand. Assuming that all goes according to plan, you should be able to access D:/Songs with the C:/Sites/muzica folder.
Remember you may have to allow Options FollowSymLinks in your site configuration as well.
I personally use this setup myself, so it should work fine. |
|
Back to top |
|
Ency
Joined: 02 Jan 2014 Posts: 4 Location: Romania, Cluj
|
Posted: Thu 02 Jan '14 23:48 Post subject: |
|
|
mklink not exist in Windows 2003 Server, mod_alias is enabled ... |
|
Back to top |
|
Anaksunaman
Joined: 19 Dec 2013 Posts: 54
|
Posted: Fri 03 Jan '14 1:45 Post subject: How can I use data outside of Apache root directory? |
|
|
Quite right. My bad. I hadn't realized you were running Server 2k3.
Not to sound like a broken record, but I would still try a link if you are running an NTFS file system with your Server 2003 set up. Instead of a symbolic link, however, you will need to use a Junction (a.k.a. directory reparse point), which serves up (roughly) the same functionality as a symlink. A junction point is essentially a hard link to a directory. (http://en.wikipedia.org/wiki/NTFS_junction_point)
Since you are running Server 2003, as I understand it, you need linkd for the command line and that is part of the Win2K Resource Kit, which costs money. So your other (free) options are to use a Server 2003 compatible version of the Link Shell Extension I mentioned above or possibly:
Junction v1.06 by Mark Russinovich
http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx
Both these utilities can create a Junction on a Server 2003 NTFS file system.
The only drawback to using hardlinks or junction points is that the require special care to remove, since the Junction and linked directory are treated as if they were one and the same. So if you want to delete your C:/Sites/muzica folder while it is serving as a Junction for D:/Songs, you need to use the utilities mentioned to do or otherwise take precautions:
http://comptb.cects.com/2268-overview-to-understanding-hard-links-junction-points-and-symbolic-links-in-windows
"A Junction Point should never be removed in Win2k, Win2003 and WinXP with Explorer, the del or del /s commands, or with any utility that recursively walks directories since these will delete the target directory and all its subdirectories. Instead, use the rmdir command, the linkd utility, or fsutil (if using WinXP or above) or a third party tool to remove the junction point without affecting the target. In Vista/Win7, it’s safe to delete Junction Points with Explorer or with the rmdir and del commands."
The danger lies in that improperly deleting a Junction can cause recursive removal of the files stored in the original folder (good-bye songs!).
As I have tested Junctions as well, I can say that a Junction point will give you the same effect (for access purposes) as a symbolic link.
-------
If you still can't use a Junction for some reason, then your only other possible option seems to me to be to attempt to give Apache permission to access the D:/Songs folder. However, my experience is that this is a sketchy way to do it and very likely will not work. |
|
Back to top |
|
Ency
Joined: 02 Jan 2014 Posts: 4 Location: Romania, Cluj
|
Posted: Fri 03 Jan '14 9:59 Post subject: |
|
|
Suggested way seems too complicated. If I can not solve easily I give up and move some songs in C:/Site/Muzica and I will take care to not save them all time when I make a backup of the site. Thanks anyway. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Fri 03 Jan '14 20:20 Post subject: |
|
|
I think the suggestion to remove the two Directories was in error, they have to be given access. Granted, you have given the entire C drive (/) access which is not a good thing.
If it were me, here is what I would have.
DocumentRoot "C:/Site/"
# Map /musica to D:\Songs
Alias /musica D:/Songs
# Deny all access at C:\
<Directory />
Options FollowSymLinks
AllowOverride None
Order Allow,Deny
Deny from all
</Directory>
# Allow access to the DocumentRoot
<Directory "C:/Site/">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory>
# Allow access to music files folder
<Directory "D:/Songs/">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
</Directory> |
|
Back to top |
|
|
|
|
|
|