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.

Possible to have domain point to 1 directory & cpanel to another?

Discussion in 'General Discussion' started by forumfish, Nov 13, 2011.

  1. forumfish

    forumfish Member

    Joined:
    Nov 13, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    First, I am new with cpanel but have significant experience with command line. The sites that I am building share the same source code but are owned by different customers.

    My goal is to stick with the standard account setup steps of adding an account for each domain name. When the accounts are created I want it to point to different directions though.

    Account 1 = DOMAIN-1.com --> ROOT
    Account 2 = DOMAIN-2.com --> ROOT

    Account 1 = Cpanel --> ROOT/Account-1/folder
    Account 2 = Cpanel --> ROOT/Account-2/folder

    If anyone knows how this can be accomplished, either by script or modifying configuration of Account Setup the help would be much appreciated.

    If a script has to be written, I am willing to purchase the service of a known professional.
     
  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
    Wouldn't it be easier to create these as addon domains off of a main domain. Addon domains can have their own FTP login password.

    What is confusing me is the source code portion anyway because you cannot have two accounts able to share the same source code but editing it within their own folder without impacting the source code. What exactly needs to be done for editing purposes or cPanel access purposes? You want the http site to be the same site for these users but the users able to add their own email accounts and edit everything but for the Apache files?
     
  3. forumfish

    forumfish Member

    Joined:
    Nov 13, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    My goal is to assign different IP addresses to each domain. So having them as "addon domains" only gives them to share the same IP address.

    Yes, I want the ability to give someone access to cPanel for email controls, and I don't want the emails to share same directory.
     
  4. forumfish

    forumfish Member

    Joined:
    Nov 13, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I want to be able to assign seperate IP addresses to each domain / account.

    Yes, it is so they can control their own email accounts.
     
  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
    The only way you can get this to work is to either use DSO which allows sharing the same document root due to nobody running the group process for PHP files, or to disable FileProtect under suPHP. Otherwise, different accounts cannot share the same source content.

    As for editing the document root path but keeping the account's home directory itself elsewhere so they can't edit the files and only have emails in that other location, you can edit the document root in /var/cpanel/userdata/username/domain.com file where username is the cPanel username and domain.com is the domain name.

    After editing the document root in that file, you'd need to do the following commands:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak111114
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
     
  6. forumfish

    forumfish Member

    Joined:
    Nov 13, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thank you Tristan for your help.

    Is it possible to write a script that will do all the necessary modifications to the httpd.conf file each time an account is created?

    I am looking to automate this process the best way possible.
     
  7. 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
    Yes, you can create a script called /scripts/postwwwacct that can make such changes at the end of account creation. You can read our documentation about this script hook at the following location:

    ScriptHooks < AllDocumentation < TWiki
     
  8. forumfish

    forumfish Member

    Joined:
    Nov 13, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I read through the hooks, but seems there is no way to easily manage the document root "postwwwacct", or even on domain addon.

    The knowledge you provided has got me on the right track I believe though. I can achieve what I need using "/var/cpanel/userdata/username/domain.com" and changing document root. What I need to accomplish finding a way to create a script that will do the following post-processes:

    1) Account Created -> set document root to [source location]
    2) Sub-domain Created -> set document root to [source location]

    ********************************************************
    If possible, I would like to throw in an IF / ELSE statement for the sub-domain creation that will set it to [source location] only if something is checked, otherwise will goto username/domain/public_html.

    EXAMPLE:

    blog.domain.com -> checked -> [source location]
    blog2.domain.com -> unchecked -> default (aka [username/domain/public_html])
     
  9. 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
    You are getting into territory that should be posted into the developers section of the forum. Manual configuration changes and what needs to be changed along with simple scripting can be posted here, but once you are asking questions on a script you are writing to modify accounts on creation, that is development.

    That forum would be the following:

    cPanel Developers
     
Loading...

Share This Page