how do I symlink a web directory ?

Discussion in 'Programming' started by z0diac, Apr 13, 2009.

  1. #1
    Ok, I have 2 drives on my server. drive1, and drive2. Drive1 is near capacity.

    I want to move a large web directory (just a subdirectory, not the entire web site) over to drive2 and have it symlinked so any accesses to that directory will automatically go over and access the files on drive2.

    Drive2 is called /backup

    The web directory I want to move is located here:

    /var/www/vhosts/zeroreality.com/httpdocs/test

    so I did a

    mv test /backup
    ln -s /backup/test /var/www/vhosts/zeroreality.com/httpdocs/test


    But... that didn't work. Said access denied. I did a chmod 777 /backup/test and the test symlink file and still no go.

    What am I doing wrong? I'm guessing I'm naming the symlink wrong?
     
    z0diac, Apr 13, 2009 IP
  2. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #2
    Make sure you have assign ownership of test folder to user not root:root.

    You can change ownership from SSH:

    chown user:user test

    replace user with your actual username.

    Kailash
     
    kailash, Apr 13, 2009 IP
  3. z0diac

    z0diac Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    When I moved the directory over, the ownership did not change (stays as 'psacln' which is what the other web dirs are). The one difference when I do a "ll" or ls -l is that the moved directory is higlighted in green, whereas other dirs are just in blue text. (??? not sure what that means)

    My guess would be that I'm not assigning the right link name and apache doesn't recognize it?

    Ok, I just did a:

    cd /var/www/vhosts/zeroreality.com/httpdocs
    mv test /backup
    ln -s /backup/test test


    And I get:

    Forbidden
    You don't have permission to access /test on this server.


    When trying to access zeroreality.com/test on the web.

    I did a chmod 777 /backup/test as well as the index.html file in test, as well as the link file 'test' at /var/www/vhosts/zeroreality.com/httpdocs/test

    ??
     
    z0diac, Apr 14, 2009 IP
  4. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #4
    Green indicates symlink. All symlinks are displayed in green text.

    I am not sure why is it not working. May be there is any additional settings in plesk needed or some special permissions/ownership for symlink.

    Kailash
     
    kailash, Apr 14, 2009 IP