[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 520
  • Last Modified:

linux simple linking between 2 folders

Hello experts

The goal is to create a simple link in Linux (I guess it is ln function):
I have a real folder on my server
/red5/videos

and I want to link it to /home/site/public_html/videos


so any file that is created into /red5/videos
will be acessible through /home/site/public_html/videos

ex: /red5/videos/file1.flv

will be accessible in :  /home/site/public_html/videos/file1.flv

As you guess  /home/site/public_html/videos/ is the path to Apache, so any video created in  /red5/videos/file1.flv will be accessible through the web

I need to link   it and not create a copy : everything is stored in /red5/videos/ but accessible through  /home/site/public_html/videos/

Regards
0
yarekGmail
Asked:
yarekGmail
  • 3
  • 2
  • 2
  • +2
1 Solution
 
stetorCommented:

ln -s /red5/videos  /home/site/public_html/videos

ensure that /red5/videos have read and exec permission for the web server or all
0
 
farzanjCommented:
#save the current contents of folder
mv /home/site/public_html/videos /home/site/public_html/videos.old
ln -s /red5/videos /home/site/public_html/videos

Link part is done.

Now I have to do the Apache part because I have to enable links in Apache.

What type of Linux is it?  What version?
0
 
yarekGmailAuthor Commented:
using ln command will not make it accessible through apache ?

uname -r
2.6.9-78.0.5.ELsmp

cat /proc/version
Linux version 2.6.9-78.0.5.ELsmp (mockbuild@builder16.centos.org) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)) #1 SMP Wed Oct 8 07:12:03 EDT 2008

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
farzanjCommented:
So you also need to allow Apache to allow symlinks

So in your httpd.conf file or apache.conf depending upon your type of Linux, have something like
<Directory /red5>
    Options FollowSymLinks
    AllowOverride None
</Directory>
0
 
aliganjeiCommented:
as farzanj and stetor explained, you have two seperate tasks to perform:
1- creating symbolic link for your video directory under your web documents directory; this is performed by using ln -s linux command:
ln -s /red5/videos  /home/site/public_html/videos

2- This newly created directory is not a normal directory, it is a symbolic link and Apache will not allow it's users to see it's contets; so you have to configure Apache in a way that allows "Following Symbolic Links":
    Options FollowSymLinks
0
 
underskyCommented:
if symlink not work, you can use this:

mkdir /home/site/public_html/videos
mount --bind /red5/videos /home/site/public_html/videos



or ln -s /red5/videos /home/site/public_html/videos  (that peoples talking above), with FollowSymlinks into apache conf, (don't forget restart apache2 web server after)

also for not remount everytime when you reboot server, add

this:
mkdir /home/site/public_html/videos
mount --bind /red5/videos /home/site/public_html/videos


into /etc/rc.local file

before
exit 0
0
 
underskyCommented:
brr, without mkdir >_< of corse, you need mkdir only once, to create videos folder into your site folder ))
0
 
underskyCommented:
ah and don't forget  add permisions to read, and access, to all or add apache group to access (apache2 use "www-data" as group, and owner.
0
 
stetorCommented:
YarekGmail,

You have to proceed step by step so we can help you.

start with the link
ln -s /red5/videos  /home/site/public_html/videos

and add the read permission for the user of the web server (may be www-data ?)
chmod -R g+rw /red5/videos
chgrp -R www-data /red5/videos

after that try with the web server if you can see a file under /videos/
(some distro have already the FollowSymLink globally defined)
if you receive an error from the web server tha you need to add the
Options FollowSymLinks
in the main config file or in the specific site file or in the .htacces of the directory



0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now