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.

Remove ServerAlias from Virtualhost

Discussion in 'General Discussion' started by badzilla, Oct 21, 2010.

  1. badzilla

    badzilla Member

    Joined:
    Mar 3, 2008
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    I have created a subdomain, and struggling to keep the virtualhost as I want it.

    I remove the serveralias from the httpd.conf and use the distiller to update everything. In the datastore serveralias is correctly set to '', but whenever I rebuild httpd.conf, Cpanel insist that I must have this line

    Serveralias www.subdomain.domain.com

    How do I tell Cpanel that I don't have a serveralias ???
     
  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
    You'd need to edit /var/cpanel/userdata/username/subdomain.domain.com file where username is the cPanel username for that account and subdomain.domain.com is the subdomain's name. In that file, simply remove the line you do not want, then run these commands afterward:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak101021
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    Editing /usr/local/apache/conf/httpd.conf directly for the Virtual Host entries will not retain the changes. Those entries are primarily built from the userdata files.
     
  3. badzilla

    badzilla Member

    Joined:
    Mar 3, 2008
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Sorry, I cannot get this to work. I erased the line

    Serveralias: ''

    but after rebuilding httpd.conf, it still puts a serveralias. And given that the template for vhost looks like this:

    Code:
    [% IF vhost.serveralias_array.size -%]
    [% FOREACH alias IN vhost.serveralias_array -%]
        ServerAlias [% alias %]
    [% END -%]
    [% ELSE -%]
        ServerAlias [% vhost.serveralias %]
    [% END -%]
    I'm not totally surprised, unless I misunderstand the code.
     
  4. 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 removed the line in /var/cpanel/userdata/username/subdomain.domain.com file and it still re-added it for that domain after rebuilding Apache?

    The template is used to build new entries, it shouldn't be overwriting the existing /var/cpanel/userdata/username/subdomain.domain.com entry after it has been modified.
     
  5. badzilla

    badzilla Member

    Joined:
    Mar 3, 2008
    Messages:
    19
    Likes Received:
    0
    Trophy Points:
    1
    Yes, I removed the line completely from the datastorage, but after rebuilding the httpd.conf it was still adding a serveralias for www.subdomain.domain.com to httpd.conf

    Well, you are the expert, but I thought that everytime you rebuild httpd.conf, it uses the template for vhosts to generate the vhost entries.

    But I have to admit it is strange, because if I change the serveralias directly in the httpd.conf and uses the distiller, it updates the datastorage correctly, but still builds the httpd.conf with www.subdomain.domain.com no matter what is written in the datastorage.
     
    #5 badzilla, Oct 21, 2010
    Last edited: Oct 21, 2010
  6. 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
    Please open a ticket about this matter and provide the actual domain name being modified in the ticket. You can open a ticket using either the link in my signature or using WHM > Support Center > Contact cPanel
     
Loading...

Share This Page