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!

Changes to 'Listen' httpd.conf directives lost after every rebuild

Discussion in 'General Discussion' started by babakb, Oct 25, 2012.

  1. babakb

    babakb Well-Known Member

    Joined:
    Jan 20, 2007
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    156
    We need to specify Apache to listen on specific IP's and ports. e.g.

    Listen 127.0.0.1:80
    Listen XXX.XXX.132.12:82
    Listen XXX.XXX.132.13:82
    ... etc ...

    The settings are lost everytime httpd.conf rebuillds. We've tried:

    /usr/local/cpanel/bin/apache_conf_distiller --update

    No success. Doesn't look like the distiller retains the 'Listen' httpd.conf directives. Any solution?
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,608
    Likes Received:
    32
    Trophy Points:
    238
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You will likely need to change the Listen directives in /var/cpanel/templates/apache2/main.default by copying it to /var/cpanel/templates/apache2/main.local location, then hardcoding the ones you want into that file. Here are the entries you'd be changing:

    Code:
    [% IF configured.ip_listen -%]
    [%- FOREACH ip IN configured.ip_listen -%]
    Listen [% ip %]:[% configured.main_port %]
    [% END -%]
    [% ELSE -%]
    # Defined in /var/cpanel/cpanel.config: apache_port
    Listen [% main.listen.item.listen %]
    [% END -%]
    
    [% IF configured.ip_listen_ssl -%]
    [%- FOREACH ip IN configured.ip_listen_ssl -%]
        Listen [% ip %]:[% configured.main_port_ssl %]
    [% END -%]
    [% ELSE -%]
        # Defined in /var/cpanel/cpanel.config: apache_ssl_port
        Listen [% main.ifdefinessl.listen.item.listen %]
    [% END -%]
    Afterward, then just run the following:

    Code:
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    I am not aware of any other way for those to be hard-coded without being overwritten on EasyApache recompile or httpd rebuild.

    Thanks!v
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

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