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.

change the primary domain's web root

Discussion in 'General Discussion' started by gmedia01, Aug 24, 2012.

  1. gmedia01

    gmedia01 Registered

    Joined:
    Aug 24, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    I have access to cPanel and WHM on our dedicated server.
    In cPanel one particular domain is treated as a primary domain and others as addon domains. That primary domain's web root is "/public_html". We can add more domains and can choose any directory as their root. But don't seem to be able to change primary domain's web root.

    I want to change the primary domain's web root. How do I do that? My server support guy said I'd have to do it through SSH (Linux command line).

    Please tell me there is a way to do this without knowing Linux.

    Also, for all of those with the "why," I want all domains to have their own folder inside the public_html folder as apposed to inside the first (main) website's folder. I don't want to see any other site folders when I'm editing the main site via FTP and risk deleting sites just from a mis-click or something. I've done it before :( When you look at code and stuff for a long time, things can start to blend. You know? Also, coders an be (probably should be) anal too, so they want things to be a certain way.

    THANK you for your time!

    Chris
     
    #1 gmedia01, Aug 24, 2012
    Last edited: Aug 24, 2012
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Re: Change directory of Main Domain

    Hello Chris,

    There is not a way to change it without knowing SSH. This is set in /var/cpanel/userdata/username/maindomain.com file. If you want to change the documentroot there, you'd revise the /home/username/public_html line and then run the following commands to update Apache's configuration:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak120824
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    You might consider posting a feature request for the main domain to be configurable for a different path during account creation. That would be at Feature Requests for cPanel & WHM for new feature requests.

    Thanks!
     
  3. charsleysa

    charsleysa Active Member

    Joined:
    Jul 18, 2011
    Messages:
    41
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Palmerston North, New Zealand
    cPanel Access Level:
    Root Administrator
    Re: Change directory of Main Domain

    gmedia01, I am curious as to why you want all domains to have their own folders inside /home/<username>/public_html/ instead of /home/<username>/
    The latter seems to be a better alternative as you don't have to deal with another tier in the directory tree.
    Also note that addon domains don't have to be placed in public_html, they can be placed inside any folder in /home/<username>/
     
  4. gmedia01

    gmedia01 Registered

    Joined:
    Aug 24, 2012
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Re: Change directory of Main Domain

    Did you read the other half of my original post? Does that answer your question?

    Thanks!

    Chris

    - - - Updated - - -

    I am concerned that you are right. I saw a post back in 2009 that asked the same thing and someone replied that it would be "fixed" or added in the next release. Three years later....

    Well, I definitely don't know SSH. I don't even know where to access it. I'll snoop around WHM...

    Thanks for the help!

    Chris
     
  5. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Re: Change directory of Main Domain

    If you cannot learn SSH, then you might want to hire someone, because you will need someone to manage the server who knows SSH at some point. You cannot do everything with a control panel frontend.

    Here's a catalog of system administrators and developers:

    Sys Admin Services | cPanel App Catalog
     
  6. charsleysa

    charsleysa Active Member

    Joined:
    Jul 18, 2011
    Messages:
    41
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Palmerston North, New Zealand
    cPanel Access Level:
    Root Administrator
    Re: Change directory of Main Domain

    Sorry it only partially answers my question because with your way you are just creating more hassle for yourself when a solution for what you want to do is already available without have to do anything in SSH, all you have to do is put the folders inside /home/<username>/ instead of /home/<username >/public_html/ and leave the main domain inside public_html
     
  7. mgrant

    mgrant Registered

    Joined:
    May 4, 2013
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Reseller Owner
    Re: Change directory of Main Domain

    Stefan,

    I ran across this thread trying to understand what the correct way was to host multiple domains out of a single cpanel account.

    Imagine you want to host domain1.com and domain2.com. So you create an account in cPanel, probably you start with domain1.com. This domain ends up in public_html/. You then do an add-on domain and now where do you put this domain? in public_html_domain2/? It's a bit messy.

    I see 2 possible solutions:

    1) create a second tier inside public_html as in public_html/domain1.com/ and public_html/domain2.com, or
    2) instead of creating /home/user/public_html, create /home/user/domain1.com/

    I would like to see a template which I could use $domain to create these folders, for example, I'd like to configure either public_html or $domain.

    Michael Grant
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Re: Change directory of Main Domain

    The field for the directory where addon domains store their files is automatically populated as public_html/$domain. Could you elaborate a bit more on the differences you would like to see based on what is already in-place with the existing system?

    Thank you.
     
  9. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Accidentally deleting a directory is a human problem, not a technology problem. Technology can provide some safeguards (e.g. backup for restoration) but cannot ultimately prevent or solve the human problem. Moving the directory to a sub directory because a person might accidentally delete the directory will not solve the problem.

    As for myself, I leave my primary domain in /home/user/public_html; and place my additional domains like:

    /home/user/domains/example.com
    /home/user/domains/example.net

    I do the same for sub domains.

    I suppose if one frequently creates domains, having to change the document root form field every time would be annoying. For those I suppose a user-preference 'where should the default document root be suggested' would be helpful.
     
Loading...

Share This Page