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.

How to edit all vhost on cpanel

Discussion in 'General Discussion' started by haulpd, May 20, 2011.

  1. haulpd

    haulpd Member

    Joined:
    May 20, 2011
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    I'm have just install mod_cband for apache. but i can't edit httpd.conf. I want to add config as CBandSpeed, CBanLimit to per host. How to add this config to all vhost on apache ?
    anyone helps ?

    sorry about my english.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Hello,

    You could add an include at /usr/local/apache/conf/userdata location called cband.conf with the contents you need for all vhosts, then run the following to check the include:

    Code:
    /scripts/verify_vhost_includes
    If it checks out okay, you would then add it after making a backup of Apache's configuration:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak110521
    /scripts/ensure_vhost_includes --all-users
    Finally, you would distill Apache configuration, rebuild Apache configuration, and restart Apache:

    Code:
    /usr/local/cpanel/bin/apache_conf_distiller --update
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    Thanks!
     
  3. haulpd

    haulpd Member

    Joined:
    May 20, 2011
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    thank you, but i can't found userdata in /usr/loca/apache/conf/.
    i was changed at /var/cpanel/templates/apache1/vhost.default and it update to httpd.conf.
    But how to change per vhost without being overwritten by cpanel.
    Thanks you.
     
    #3 haulpd, May 21, 2011
    Last edited: May 21, 2011
  4. astopy

    astopy Well-Known Member

    Joined:
    Apr 3, 2003
    Messages:
    165
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    If you copy /var/cpanel/templates/apache1/vhost.default to /var/cpanel/templates/apache1/vhost.local you can make changes to vhost.local without them being overwritten by cPanel.

    Though, it might be better to use an include in the userdata directory as suggested by Tristan (you can probably just create the directory if it doesn't already exist).
     
  5. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You would create the directory if it doesn't exist.

    Creating .local files isn't recommended when those are supported, since .local files will ensure the main Apache configuration doesn't get updated when we implement changes. The recommended path would be include files such as how I described.
     
Loading...

Share This Page