4 years, 2 months ago DevOps
Hello readers! After a long time I am back with a new topic. Today I am going to discuss about cPanel bandwidth problem. The websites on your server may use heavy traffic but cPanel bandwidth counter always show that they are using a low bandwidth. Then you can understand that cPanel can't count bandwidth correctly. Actually we get this issue when we try to use Nginx/Varnish as a web-proxy in front of Apache. I have also got this problem about 3 months ago and was thinking that it may be a known bug of cPanel as I have seen many SysAdmin who are getting this issue when I have searched on Google for a solution. I thought that it might be fixed in the upcoming release of cPanel. When I update my cPanel to 11.46.1 (build 4), still I was getting this issue. Then I have gone in a deep research and discovered the issue.
The main culprit of this problem at my situation was my web-proxy. We know that Apache can serve a very low amount of request per second. To increase the serving rate, I used Nginx Admin to use Nginx as web-proxy. After installing it, I was feeling good as the CPU load, RAM load, even the Server load was decreased. But after some days I have pointed out the problem. However, after my deep research I have got the point.
When we use a web-proxy in front of Apache, we shift default Apache Non-SSL port 80 to other port. For example, when we install NginX Admin, it sets Apache Non-SSL port 80 to 8081 by default. But cPanel bandwidth counter script, named Bandmin, still monitor the port 80 which is just used for passing request not for processing/serving. My good luck was that Nginx Admin doesn't change Apache SSL port 443. So Bandmin can count all SSL request correctly but can't Non-SSL requests. So what is the solution?
I hope you can determine the possible solution of this problem. You have to edit the Bandmin services.conf file so that it monitors the changed port. Just follow my instructions:
(1) Login to your Server/VPS with SSH. You can use Putty for windows, but use Terminal for Linux/MAC.
(2) Now enter the following command:
(3) We will edit services.conf file now. Enter this command now:
(4) Look at the your command window. I hope you are seeing the same thing as like as the image given below. There two red marked spot on the image. Those are the things, we have to change:
(5) Now press A and start to edit. Just make all 80 to 8081. After editing press Esc.
(6) We have to save the edited file. Just press Shift+ZZ. Let's enter the following command to stop the bandwidth:
service bandmin stop
(7) Now we will start the Bandmin again. This time it will be started with its new configuration. Enter this command:
service bandmin start
(8) For a safety, just restart cPanel services.
service cpanel restart
That's all. Now your bandwidth will be counted correctly. Never be hopeless, if you see that you are getting lower bandwidth than using Apache only. Nginx use advanced gzip technology and for this your bandwidth will be saved. Let me know if you face any issue. I am here to help you. Never forget to share the link. Thanks!