ServerName and ServerAlias values reversed in httpd.conf when adding new account

mwmconsulting

Member
Apr 15, 2006
21
0
151
Greetings cPanelers,

I've come across a most peculiar situation. In the past, when I added a new account to my VPS via WHM, it would create several entries for the new domain in Apache's httpd.conf file. Among these entries were two that looked like this:

Code:
ServerAlias domain.com
ServerName www.domain.com
However, it seems as of late it's adding them like this:

Code:
ServerAlias www.domain.com
ServerName domain.com
As you can see the values have been reversed. Now, this might seem innocent enough, however it is causing problems when I try to Web Protect a directory. Basically, when accessing the protected directory it asks the username and password twice. Once for www.domain.com and then again for domain.com.

The explanation for this is here:

http://httpd.apache.org/docs/1.3/misc/FAQ.html#prompted-twice

My host provider seems to think the cPanel developers have changed the cPanel templates recently. I looked at the /usr/local/cpanel/etc/httptemplates/apache1/default file and it seems to be correct. With regards to these two values it reads:

Code:
ServerAlias #serveralias#
...
ServerName #servername#
Any idea what's going on here? Has cPanel changed something?
 

mwmconsulting

Member
Apr 15, 2006
21
0
151
Perhaps this is a bug and needs to be reported to the cPanel developers?

Anyone...anyone? Bueller...Bueller?

:confused:
 

mwmconsulting

Member
Apr 15, 2006
21
0
151
Thanks for replying mtindor.

Is there a process by which we submit this bug? I figured a cPanel admin/developer would of replied to this post by now. It's a pretty major bug.

:confused:
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,216
11
313
Houston, TX
cPanel Access Level
Root Administrator
Thanks for replying mtindor.

Is there a process by which we submit this bug? I figured a cPanel admin/developer would of replied to this post by now. It's a pretty major bug.

:confused:
cPanel Developers, Support Staff etc. do not routinely monitor the community forums. If you wish to submit a feature request or bug report, please do so via:

http://bugzilla.cpanel.net

If you feel the issue is urgent and desire a support team member to look into the issue for you, submit a support ticket.

These forums are not an official means of submitting bug reports, feature requests or support issues.
 

ile

Registered
Aug 10, 2010
2
0
51
I have this same problem and I've been having it for quite a while.

In the bug report it says that it is fixed. So, what the current situation might be?

In my vhost.default file I have these:

Code:
ServerName [% vhost.servername %]
ServerAlias [% vhost.serveralias %]
So they seem to be ok. But when I create a site (naming it x.com or www.x.com) it always ends up as ServerName x.com (I would like it to be www.x.com) which ends up causing problems.

Any ideas? Should I reopen the bug, create a new bug or am I doing something wrong?

Thanks.
 
Last edited:

ile

Registered
Aug 10, 2010
2
0
51
One thing,

In /var/cpanel/userdata/x/x.com file I have these

Code:
serveralias: www.x.com
servername: x.com
So, at least these are consistent with the generated httpd.conf.

But, how could I reverse these? I would like to have

Code:
serveralias: x.com
servername: www.x.com
Thanks again.
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,608
77
308
cPanel Access Level
Root Administrator
Account creation uses different templates for generating the VirtualHost entry than the rest of the system does. The templates used are in /usr/local/cpanel/etc and are overwritten during each update. There is work underway to convert account creation to using the same templates as the rest of the system but there is no ETA on completion.