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.

Moving the "Root" Directory on my VPS

Discussion in 'General Discussion' started by drokkon, Nov 8, 2011.

  1. drokkon

    drokkon Registered

    Joined:
    Nov 8, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Colorado Springs, Colorado, United States
    cPanel Access Level:
    Website Owner
    I'm on a VPS with WHM and I've stumbled my to creating an account for a domain. I installed Wordpress Multisite in the root directory; the main blog is the same domain, and I have another dozen domain names pointed to my IP address and "parked" on top of the original domain, with a domain name Wordpress plugin sorting it all out.

    My problem: I want to play around with Magento, and figured that a subdomain would be the best bet. I tried creating a new account for the subdomain, but then realized that I could just set up the subdomain within cPanel for the main domain. So far, so good. What is NOT good is that it set up a folder for my subdomain inside the root folder. Unfortunately, this is where my Wordpress resides, and I really don't want the new folder to sit "inside" Wordpress right along with folders like wp-admin, wp-content, wp-includes.

    SO. The question is, can I move everything currently inside the root directory to a subfolder (say, "wordpress")? I'm not exactly what I'd have to do in order to make sure that visiting the main domain would bring up the wordpress folder.

    I hope that's somewhat clear, and I sincerely appreciate any help you may be able to provide!
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I'm not entirely certain I understand when you say root folder. Is the path /home/username/public_html/subfolder for the Magento installation? If so, then I would remove and recreate the subdomain and specify the path to be /home/username/subfolder provided your hosting provider allows non-public_html subdomains. If they do, you should be able to set the directory path during the subdomain creation process by editing the path listed in the cPanel > Subdomains > Document Root field.
     
  3. drokkon

    drokkon Registered

    Joined:
    Nov 8, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Colorado Springs, Colorado, United States
    cPanel Access Level:
    Website Owner
    Thanks so much for your help! That WILL actually work. :)

    I do have another question, as I recreated my subdomain and now my browser can't find it. I have my main domain set up at a registrar and pointed to the IP address of my VPS. Do I also have to set up the subdomain at my registrar, or should setting it up on cpanel be sufficient?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    27,726
    Likes Received:
    423
    Trophy Points:
    83
    cPanel Access Level:
    Root Administrator
    Hello :)

    You will need to add in the "A" records for your subdomains at the DNS host of the domain name. Ensure the "A" records for the subdomains point to the IP address of the account.

    Thank you.
     
  5. drokkon

    drokkon Registered

    Joined:
    Nov 8, 2011
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Colorado Springs, Colorado, United States
    cPanel Access Level:
    Website Owner
    I suspected that. Again, thank you VERY much! Changed the A record, and now we play the waiting game...

    One last question: you gave me a great idea on how to move the subdomain's folder out of the public_html folder, but what if I wanted to change the path to the folder that serves up the main domain?

    In other words, I know where to find the field to change the path to a subdomain's folder, but no idea where to change the path to the main domain's folder.
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    18
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    For the main domain, the only way to change the path would be in /var/cpanel/userdata/username/domain.com file where domain.com is the main domain name. You'll documentroot and homedir paths there for the location where the main domain is served.

    If you edit that file, you will need to run the following commands to update the paths:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak111114
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    I highly suggest making a backup of that file before you edit it:

    Code:
    cd /var/cpanel/userdata/username
    cp domain.com domain.com.bak111114
    Above wherever username is mentioned, this stands for the cPanel account username. Wherever domain.com is mentioned, this represents the main domain on that account.
     
Loading...

Share This Page