Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Fast-swapping the public_html directory

Discussion in 'General Discussion' started by Dizyart, Jul 13, 2013.

  1. Dizyart

    Dizyart Member

    Joined:
    Jul 11, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I have two versions of the site which I have to swap really fast, multiple times.

    In my home directory, I have:

    Code:
    drwxr-x---  8 lorem  nobody      4096 Jul 12 20:50 public_html/
    drwxr-x---  3 lorem  nobody      4096 Jul 13 12:59 public_html_3.0/
    public_html holds the current website, public_html_3.0 holds the new website.

    I wish to replace the two by doing:

    Code:
    //move the complete current site to another tmp location
    mv public_html public_html_2.0 
    //move the new site in place
    mv public_html_3.0 public_html 
    After trying it on a test account, I get a Forbidden You don't have permission to access / on this server. error.

    I have made sure that the public_html_* folders have identical permissions, but I guess it's a symlink issue? Am I trying to do something unthinkable and highly not recommended?

    Using VPS WHM11.38.1/Cpanel11 with root privileges on CentOs 5.9.

    Thanks!
     
  2. Dizyart

    Dizyart Member

    Joined:
    Jul 11, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    After some webreading, I have removed public_html (moved to temp) and sym-linked public_html -> public_html_3.0 resulting in:


    Code:
    drwxr-x---  3 lorem nobody      4096 Jul 13 12:59 public_html_2.0/
    drwxr-x---  2 lorem nobody      4096 Jul 13 14:02 public_html_3.0/
    lrwxrwxrwx  1 lorem nobody           15 Jul 13 14:11 public_html -> public_html_3.0/
    lrwxrwxrwx  1 lorem lorem            11 Jul  9  2012 www -> public_html/
    Still the same result.
     
  3. quietFinn

    quietFinn Well-Known Member

    Joined:
    Feb 4, 2006
    Messages:
    998
    Likes Received:
    11
    Trophy Points:
    168
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    That should work.

    I tested in a test account and no problems at all.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Dizyart

    Dizyart Member

    Joined:
    Jul 11, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    This was my guess too. But I figure it has something to do with Apache FollowSymlink configuration.

    In WHM >> Service Conf. >> Apache Config. >> Global Configuration I have enabled:

    Directory “/” Options:
    Follow SymLink (checked)
    SymLinksIfOwnerMatch (checked)

    But I guess this might be overriden in a VHost file or something. :( :(

    - - - Updated - - -

    And here's the currently active httpd.conf (searched for Sym)

    Code:
    lorem@server [~] grep 'Sym' /usr/local/apache/conf/httpd.conf
    Options ExecCGI FollowSymLinks IncludesNOEXEC SymLinksIfOwnerMatch
    Options Includes Indexes FollowSymLinks
    
    Actual except from file:

    Code:
    <Directory "/">
        Options ExecCGI FollowSymLinks IncludesNOEXEC SymLinksIfOwnerMatch
        AllowOverride All
    </Directory>
    
    Vhost definitions do not mention SymLinks...

    --- edit ---

    My Apache error logs mentions it, though:

    Code:
    Symbolic link not allowed or link target not accessible: /home/lorem/public_html
     
    #4 Dizyart, Jul 13, 2013
    Last edited: Jul 13, 2013
  5. Dizyart

    Dizyart Member

    Joined:
    Jul 11, 2012
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    OK, following up:

    I figured my directory structure was way off.

    My public_html_2.0 directory included another public_html folder... just a painful, wrongful unzip.

    But another issue has come up:

    Permission denied: /home/lorem/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

    But here's the ls result:

    Code:
    lorem@server [~] ls -l public_html/
    -rw-r--r--  1 lorem lorem  233 Feb  7 15:23 .htaccess
    -rw-r--r--  1 lorem lorem 1412 Sep 26  2012 index.php
    
    AND checking the symlinks:
    
    lorem@server [~] ls -l 
    lrwxrwxrwx  1 lorem  lorem           11 Jul  9  2012 www -> public_html/
    lrwxrwxrwx  1 lorem  lorem           15 Jul 13 15:45 public_html -> public_html_2.3/
    drwxr-x---  9 lorem  lorem         4096 Jul 13 15:56 public_html_2.3/
    
     
    #5 Dizyart, Jul 13, 2013
    Last edited: Jul 13, 2013
  6. LDHosting

    LDHosting Well-Known Member

    Joined:
    Jan 19, 2008
    Messages:
    93
    Likes Received:
    2
    Trophy Points:
    58
    cPanel Access Level:
    Root Administrator
    It's likely the ownership on the public_html_2.3 folder. Try lorem:nobody
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #6 LDHosting, Jul 13, 2013
    Last edited: Jul 13, 2013
  7. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,400
    Likes Received:
    1,952
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    I don't see a reason why symbolic links would be necessary. Instead, you should investigate the initial "Forbidden" error message when moving the new public_html directory in place. What permissions/ownership values did the new public_html directory have?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice