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.

Mapping a New Domain to Another Document Root

Discussion in 'General Discussion' started by webr00t, Feb 5, 2008.

  1. webr00t

    webr00t Member

    Joined:
    Aug 15, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    I just upgraded from Apache 1.3x to 2.2.6 and I'm a little weirded out by the new method for editing -- or not editing -- httpd.conf, so some things I used to do normally are kind of daunting. I've just set up an account that has multiple domains that need different document roots. So I have domain1.com that needs the doc root of /home/user/public_html. No problem, that's the main domain, so that works. But for domain2.com, I need the doc root to be /home/user/public_html/publication.

    Since I'm warned not to edit the httpd.conf under penalty of death, what is the best way to go about this? Do I need to park the domain first, or not park it, in cPanel? Do I edit the pre_virtualhost include file or the post_virtualhost include file?

    Thanks in advance for your help.
     
  2. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Make them addon domains. As long as you are using the X3 theme, you can specify the Document Root when creating an Addon domain.
     
  3. webr00t

    webr00t Member

    Joined:
    Aug 15, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Thanks, Kenneth. I tried this, and it didn't work. Here's what I entered:

    New Domain Name: domain2.com
    Document Root: /public_html/publication

    I didn't really know what to do about subdomain/username, or what it's for, since I've never done an addon before, but I gave it a made-up name and pw.

    Now when I browse domain2.com I get a connection timeout response. But if I browse domain2.com/publication, it shows me what I expect.

    Am I missing something?
     
  4. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    That doesn't sound correct. You should be able to browse to domain2.com. What is your full cPanel version number?

    Do the VHost entries in httpd.conf look correct? Especial the ServerAlias and DocumentRoot entries.
     
  5. webr00t

    webr00t Member

    Joined:
    Aug 15, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel 11.17.0-STABLE (build 19434) using X3

    Here's what the VirtualHost entry reads in httpd.conf, above the nested Module tags:

    ServerName subdomain.domain1.com
    ServerAlias domain2.com www.domain2.com
    ServerAlias www.subdomain.domain1.com
    DocumentRoot /home/username/public_html/publication
    ServerAdmin webmaster@subdomain.domain2.com
    ## User [accountUserName] # Needed for Cpanel::ApacheConf
    UseCanonicalName off

    Where subdomain is what I entered for username/subdomain and [accountUserName] is the name of the cPanel account. Not sure why I'm translating all of this, but that seems to be best practice.

    Thanks again for your prompt attention to this!
     
  6. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    What shows up in the Apache error logs when visiting domain2.com ? Also, does domain2.com resolve properly to the server?
     
  7. webr00t

    webr00t Member

    Joined:
    Aug 15, 2007
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hey Kenneth. Lo and behold, it was a dns-level resolving problem. Very odd that I changed nameservers on 7 domains, then set them all up in the new DNS the same way, and one of them took an extra 30 hours or so to resolve properly. If I had just parked it like I did the others, I would have realized the problem, but I thought it was the different httpd.conf settings that were causing it. I guess that's a good lesson to learn -- always make sure the domain is resolving properly before getting frustrated about conf settings!

    Thanks for all your attention. We're in the clear now, and the addon method is working just fine.

    B
     
  8. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Glad you were able to sort it out.
     
Loading...

Share This Page