Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Unqualified short hostname in httpd.conf

Discussion in 'General Discussion' started by pthirose, Oct 22, 2012.

  1. pthirose

    pthirose Member

    Mar 30, 2010
    Likes Received:
    Trophy Points:
    In short, what's the correct/easiest/best way to insert the unqualified short hostname into httpd.conf? I'm not sure if it's better done via hook or via template, or some other method. cPanel 11.32, RHEL5-64bit.

    In a bit more detail...say our domain is and we create a cPanel site Our computers on our network are set to default DNS suffix extension of, so we can access our network resources via just the short hostname. So we can access the cPanel site with just "one" rather than "".

    But the hostname "one" is *not* in /usr/local/apache/conf/httpd.conf. The name "" (along w/all the other names that get created by default such as, and so on) is in httpd.conf. But not the short hostname "one".

    Since this change requires adding the short hostname into the ServerAlias line, I was hoping it'd be a simple template change, and I can't just use Include files. But this would apply to both newly created domains and accounts, as well as sub/addon-domains. This would apply for both SSL and non-SSL hosts, all in Apache2.

    As an example, I *think* this is the part that needs to be changed. But I don't know the vhost.?? that would be the short hostname, and I don't know the syntax (from /var/cpanel/templates/apache2/vhost.default):
    [% IF vhost.serveralias_array.size -%]
    [% FOREACH alias IN vhost.serveralias_array -%]
        ServerAlias [% alias %]
    [% END -%]
    [% ELSE -%]
        ServerAlias [% vhost.serveralias %]
    [% END -%]
    I'm guessing that 3rd line needs to change to add some kind of [% shorthostname %] or something along those lines.

    Leads appreciated.
    Thank you,

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice