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!

SOLVED Changing document root for primary domain does not work

Discussion in 'General Discussion' started by kjdion84, Apr 18, 2018.

  1. kjdion84

    kjdion84 Member

    Joined:
    Apr 18, 2018
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    toronto
    cPanel Access Level:
    Root Administrator
    I've done the following:

    nano /var/cpanel/userdata/username/mysite.com

    Changed documentroot from /home/username/public_html to /home/username/public_html/mysite.com/public

    rm -vf /var/cpanel/userdata/username/mysite.com.cache

    /scripts/updateuserdatacache
    /scripts/rebuildhttpdconf
    service httpd restart

    It DOES NOT WORK. It breaks the website entirely. Why???
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @kjdion84,

    I used the following steps to successfully modify the default document root for a domain name:

    1. Update the "documentroot" value to the new path in the following files:

    /var/cpanel/userdata/username/domain.tld
    /var/cpanel/userdata/username/domain.tld_SSL

    2. Remove the existing cache files:

    Code:
    rm /var/cpanel/userdata/username/domain.tld.cache
    rm /var/cpanel/userdata/username/domain.tld_SSL.cache
    3. Rebuild the cache files and the Apache configuration file:

    Code:
    /scripts/updateuserdatacache
    /scripts/rebuildhttpdconf
    4. Restart Apache:

    Code:
    /scripts/restartsrv_httpd
    It looks like you may not have restarted Apache. Can you let us know if that solves the issue?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    MaxFein likes this.
  3. kjdion84

    kjdion84 Member

    Joined:
    Apr 18, 2018
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    toronto
    cPanel Access Level:
    Root Administrator
    Nope.

    I get the following when visiting the domain:

    This page isn’t working
    mydomain.com is currently unable to handle this request.

    HTTP ERROR 500
     
  4. kjdion84

    kjdion84 Member

    Joined:
    Apr 18, 2018
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    toronto
    cPanel Access Level:
    Root Administrator
    OK so it works if I use:

    /home/username/public_html/public

    Instead of:

    /home/username/public_html/mysite.com/public

    Is there a way to make it work with the second example? Does the period need to be escaped or something?
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @kjdion84,

    I couldn't reproduce the issue when following the instructions noted in my previous response and using a directory name with a period as the document root. EX:

    Code:
    documentroot: /home/username/public_html/testing.directory/123
    It's possible the "nano" command-line editor is the culprit here. Can you try using "vi" instead of "nano" to see if you notice a difference in the behavior?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. kjdion84

    kjdion84 Member

    Joined:
    Apr 18, 2018
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    toronto
    cPanel Access Level:
    Root Administrator
    I'm an idiot. Everything is working from the server point of view, I was missing a couple PHP extensions I had to install via EasyApache.

    Sorry and thanks for the help.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    43,961
    Likes Received:
    1,821
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Not a problem! I'm glad to see you were able to solve the issue.
     
    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