The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    10
    Trophy Points:
    18
    Location:
    Finland
    cPanel Access Level:
    Root Administrator
    That should work.

    I tested in a test account and no problems at all.
     
  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:
    8
    cPanel Access Level:
    Root Administrator
    It's likely the ownership on the public_html_2.3 folder. Try lorem:nobody
     
    #6 LDHosting, Jul 13, 2013
    Last edited: Jul 13, 2013
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
Loading...

Share This Page