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.

Unqualified short hostname in httpd.conf

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

  1. pthirose

    pthirose Member

    Joined:
    Mar 30, 2010
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    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 blah.com and we create a cPanel site one.blah.com. Our computers on our network are set to default DNS suffix extension of blah.com, so we can access our network resources via just the short hostname. So we can access the cPanel site with just "one" rather than "one.blah.com".

    But the hostname "one" is *not* in /usr/local/apache/conf/httpd.conf. The name "one.blah.com" (along w/all the other names that get created by default such as www.one.blah.com, 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):
    Code:
    [% 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,
    PH
     

Share This Page