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.

Suppressing ServerAlias www.domain.com or specify new DocumentRoot

Discussion in 'General Discussion' started by UltraMonk, Dec 22, 2011.

  1. UltraMonk

    UltraMonk Member

    Joined:
    Dec 5, 2011
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    I have setup an account for one of my clients with their domain name, however their hostname of www.domain.com gets added as a ServerAlias to Apache pointing to their own accounts directory space.

    I need to either suppress the creation of the www hostname so I can add that as a ServerAlias to a VirtualHost container I need to create for my own software

    OR

    be able to change where the DocumentRoot points too in the VirtualHost container for that account.

    This comes back to my previous query in being able to create my own custom VirtualHost containers, but those custom VirtualHost containers are NOT required for the majority of domain names hosted on our cPanel enabled web server.

    Any solutions?

    Something else that I have discovered which is very very annoying, when adding in an addon domain it sets up a ServerName of SubDomain.AccountDomain.com

    eg

    Main Domain is domain1.com
    Addon Domain is domain2.com

    ServerName becomes domain2.domain1.com
    with a
    ServerAlias www.domain2.domain1.com

    This is bloody awful, how can I stop this from happening?
     
    #1 UltraMonk, Dec 22, 2011
    Last edited: Dec 22, 2011
  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
    To either remove the www.domain.com ServerAlias or change the DocumentRoot directive after account creation, both can be done in /var/cpanel/userdata/username/domain.com location. The settings in /var/cpanel/userdata build httpd.conf file.

    After making any edits to /var/cpanel/userdata/username/domain.com location, you then would need to rebuild Apache and restart Apache:

    Code:
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    Since you mention only doing this for some accounts, you could create a script that would revise /var/cpanel/userdata/username/domain.com after account creation, which you could run on accounts you want to revise after you've created the account.

    Of note, I also want to mention that there is another template file that was never discussed in the last thread you had opened discussing the VirtualHost containers. That template is /usr/local/cpanel/etc/httptemplates/apache2_2/default which controls the VirtualHost template being built for newly created accounts. This is discussed at Changes Contained within a VirtualHost Directive location. You likely already know this, but in case you did not.

    As for the addon domain question where subdomains are automatically created, I would not advise trying to stop that creation, since they are currently tied into how addon domains function under cPanel where the addon domain is the ServerAlias of the subdomain. If you try to remove or prevent the subdomain creation, you can possibly break the addon working. Instead, you may wish to post support onto the feature request where true multi-domain existence has been lodged --> http://forums.cpanel.net/f145/true-...ficates-ips-per-acct-case-40954-a-138917.html (specifically post http://forums.cpanel.net/f145/true-...-per-acct-case-40954-a-138917.html#post640973 where this is detailed in that thread).
     
  3. UltraMonk

    UltraMonk Member

    Joined:
    Dec 5, 2011
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Heh! That is the solution I needed, the files in /var/cpanel/userdata/username/domain.com

    Thanks very much!
     
Loading...
Similar Threads - Suppressing ServerAlias www
  1. itmangeo
    Replies:
    1
    Views:
    206

Share This Page