badzilla

Member
Mar 3, 2008
19
0
51
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 ???
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
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.
 

badzilla

Member
Mar 3, 2008
19
0
51
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.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
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.
 

badzilla

Member
Mar 3, 2008
19
0
51
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.
 
Last edited:

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
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