Skip to main content

Changing document root for primary domain does not work

Comments

9 comments

  • cPanelMichael
    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: 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: /scripts/updateuserdatacache /scripts/rebuildhttpdconf
    4. Restart Apache: /scripts/restartsrv_httpd
    It looks like you may not have restarted Apache. Can you let us know if that solves the issue? Thank you.
    0
  • kjdion84
    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
    0
  • kjdion84
    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?
    0
  • cPanelMichael
    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: 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.
    0
  • kjdion84
    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.
    0
  • cPanelMichael
    Hello, Not a problem! I'm glad to see you were able to solve the issue.
    0
  • kamm
    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: 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: /scripts/updateuserdatacache /scripts/rebuildhttpdconf
    4. Restart Apache: /scripts/restartsrv_httpd
    It looks like you may not have restarted Apache. Can you let us know if that solves the issue? Thank you.

    Thanks for this info. This post has similar instructions: but it includes /scripts/updateuserdomains
    Is that necessary?
    0
  • cPanelMichael
    Hi @kamm, My testing shows that running the /scripts/updateuserdomains command is not necessary. The /scripts/updateuserdatacache command is sufficient to update the userdata cache files. Thank you.
    0
  • Conex
    Hi cPanel, still have this issue, and can't resolve it, even by doing every thing you described above. regards
    0

Please sign in to leave a comment.