Displaying full Apache status in CWP

In this guide i am going to explain how to create a new module in CWP

The meny item under plugins are added in the file located at /usr/local/cwpsrv/htdocs/resources/admin/include/3rdparty.php it holds the actual text displayed under plugins.

In this guilde we are going to make a module for the full apache status. CWP only display partial apache status under the Webserver Settings -> Apache Status page.

We need to add the following code to the 3rdparty.php file

After we have added the menu item its time to add the files needed to run the functions for getting the bandwidth statistics. In the code above it uses «?module=apache_status» as the plugin name/url.
You have to go to /usr/local/cwpsrv/htdocs/resources/admin/modules and add the file apache_status.php in that folder. The content i chose to use in that file are the following code.

<noscript>
<li class="custom-menu"> <!-- this class "custom-menu" was added so you can remove the Developer Menu easily if you want -->
        <a href="index.php?module=apache_status"><span class="icon16 icomoon-icon-arrow-right-3"></span>Apache Status</a>
</li>
</noscript>
<script type="text/javascript">
        $(document).ready(function() {
                var newButtons = ''
                +' <li>'
                +' <a href="?module=apache_status"><span aria-hidden="true" class="icon16 icomoon-icon-arrow-right-3"></span>Apache Status</span></a>'
                +'</li>';
                $("ul#mn-15-sub").prepend(newButtons);
        });
</script>

That will add the Menu item under plugins. Now we need to create the functions to get the apache status from the server. We are using the server-status module in Apache to do that.

After that is installed open nano and the file apache_status.php. You could also open FTP to edit these files.

nano /usr/local/cwpsrv/htdocs/resources/admin/modules/apache_status.php

Add this content to the file

<?php
// Apache Status - Accesses v0.3

$url = "http://localhost/server-status";
$ch_session = curl_init();
curl_setopt($ch_session, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch_session, CURLOPT_URL, $url);
$result_url = curl_exec($ch_session);
echo $result_url;
?>

Now open the CWP Admin and it will look something like this:

That all you have to do. Follow me to get more update and functions like this.

 

How to build a CWP Module

In this guide i am going to explain how to create a new module in CWP

The meny item under plugins are added in the file located at /usr/local/cwpsrv/htdocs/resources/admin/include/3rdparty.php it holds the actual text displayed under plugins.

In this guilde we are going to make a module for bandwidth statistics.

We need to add the following code to the 3rdparty.php file

After we have added the menu item its time to add the files needed to run the functions for getting the bandwidth statistics. In the code above it uses «?module=vnstat» as the plugin name/url.
You have to go to /usr/local/cwpsrv/htdocs/resources/admin/modules and add the file vnstat.php in that folder. The content i chose to use in that file are the following code.

                                                  
<noscript>
<li class="custom-menu"> <!-- this class "custom-menu" was added so you can remove the Developer Menu easily if you want -->
        <a href="index.php?module=vnstat"><span class="icon16 icomoon-icon-arrow-right-3"></span>Bandwidth Statistics</a>
</li>
</noscript>
<script type="text/javascript">
        $(document).ready(function() {
                var newButtons = ''
                +' <li>'
                +' <a href="?module=vnstat"><span aria-hidden="true" class="icon16 icomoon-icon-arrow-right-3"></span>Bandwidth Statistics</span></a>'
                +'</li>';
                $("ul#mn-15-sub").prepend(newButtons);
        });
</script>

That will add the Meny item under plugins. Now we need to create the functions to get the bandwidth statistics from the server. We are using vnstat for that. To install vnstat go to terminal and type

yum install vnstat

After that is installed open nano and the file vnstat.php

nano /usr/local/cwpsrv/htdocs/resources/admin/modules/vnstat.php

Add tthis content to the file

<?php
if ( !isset( $include_path ) )
{
    echo "invalid access";
    exit( );
}

$vnstat1 = shell_exec("vnstat");
$vnstat2 = shell_exec("vnstat -t");
$vnstat3 = shell_exec("vnstat -5");
$vnstat4 = shell_exec("vnstat -hg");
$vnstat5 = shell_exec("vnstat -h");
$vnstat6 = shell_exec("vnstat -d");
$vnstat7 = shell_exec("vnstat -m");
echo "<h2>Bandwidth Statistics</h2><pre>".$vnstat1."</pre>";
echo "<br><br>";
echo "<h2>Bandwidth Top</h2><pre>".$vnstat2."</pre>";
echo "<br><br>";
echo "<h2>Bandwidth 5-Minutes</h2><pre>".$vnstat3."</pre>";
echo "<br><br>";
echo "<h2>Bandwidth Hourly Graph</h2><pre>".$vnstat4."</pre>";
echo "<br><br>";
echo "<h2>Bandwidth Hourly</h2><pre>".$vnstat5."</pre>";
echo "<br><br>";
echo "<h2>Bandwidth Daily</h2><pre>".$vnstat6."</pre>";
echo "<br><br>";
echo "<h2>Bandwidth Monthly</h2><pre>".$vnstat7."</pre>";
?>

Now open the CWP Admin and it will look something like this

That aall you have to do. Follo me to get more update and functions like this.

 

Why i switched from cPanel to CWP

Both CWP (CentOS Web Panel now rebranded to Control Web Panel) and cPanel are popular web hosting control panels, but it is subjective to say that one is definitively better than the other. The choice between CWP and cPanel depends on your specific needs and preferences. Here are some factors to consider:

  1. Cost: CWP is an open-source control panel and is available for free, while cPanel is a commercial product that requires a paid license. If cost is a significant factor for you, CWP may be a better choice. cPanel costs $59.99 per month and CWP costs $1.49 per month without support and $12.99 with support. Just here you save from $47-$58.5 monthly. This applies to servers with more than 30 accounts
  2. User Interface: The user interface (UI) of a control panel plays a crucial role in user experience. Some users find the CWP UI more intuitive and easy to navigate, while others prefer the cPanel UI. It ultimately comes down to personal preference. The WHM panel is very good and has a lot of options, many not used. CWP is a bit simpler but will do the same job as the WHM.
  3. Features and Functionality: Both CWP and cPanel offer a range of features to manage web hosting accounts. cPanel has been in the market for a longer time and is known for its extensive feature set, including email management, file management, database administration, and more. CWP also provides essential functionalities, but it may not have the same level of features as cPanel.
  4. Support and Community: cPanel has a long-standing reputation in the web hosting industry and has a large user base. This means there is a vast amount of documentation, tutorials, and community support available. CWP, being relatively newer, may have a smaller community, and finding extensive support or resources could be more challenging. CWP has a licence that includes support and they have a forum as well.
  5. Server Compatibility: cPanel is primarily designed to work with CentOS or CloudLinux operating systems, while CWP is specifically built for CentOS. If you are using a different operating system or plan to use one in the future, you may need to consider compatibility issues.
  6. Both control panels has reseller functionality, and it is easy to set up a reseller account.
  7. WHM comes with apache2, and CWP comes with the same as default. It’s much easier to change to apache+php-fp or apache+php-fpm+nginx and several other on CWP. It has its own web server settings page.

It’s essential to evaluate your specific requirements, consider your comfort level with the interface, and assess the available features and support when choosing between CWP and cPanel. Ultimately, the «better» option depends on your individual needs and preferences.

I made the change because i didnt use many of the functions of cPanel and the cost has doubled the last few year. Using a little simpler control panel that was cheaper made me use the money i saved on the cPanel license into the hardware. I went from a 6 core / 12 thread system to a 24 core / 32 thread system. I also have nvme disks with 2TB of storage and 64GB RAM.

CWP: https://control-webpanel.com
cPanel: https://cpanel.net

What control panel do you use and why did you choose it?