Limiting/throttling bandwidth for cPanel user account

Date Posted: 29-08-2017

There are few accounts on cPanel uses more bandwidth. This post explains on how to throttle/limit the bandwidth on particular cPanel account

Prerequisites:

  1. cPanel/WHM access
  2. Server Root Access
  3. bw_module, bwlimited_module. To check whether the module is installed or not, use the below command.

/usr/local/apache/bin/apachectl -M |grep bw

bwlimited_module (shared)
bw_module (shared)

Implementation:

Create a config directory for domain.

mkdir -p /usr/local/apache/conf/userdata/std/2_4/username/domain.tld/

where,

username is cPanel username

domain.tld is our domain.

Change the directory to created one

cd /usr/local/apache/conf/userdata/std/2_4/username/domain.tld/

Create a config file and append the following content.

vi cp_bw_all_limit.conf

<IfModule mod_bw.c>
  BandWidthModule On
  BandWidth all 512000
</IfModule>
<IfModule mod_bandwidth.c>
  BandWidthModule On
  BandWidth all 512000
</IfModule>

Verify the syntax of created virtualhost file.

/scripts/ensure_vhost_includes --user=username

/scripts/verify_vhost_includes

Restart the httpd service.

service httpd restart

 

Leave a Reply