New in CWP Edge / LTSFree with every CWPpro licenceWebsites up to 300x faster

CWP now includes LSPHP, LSAPI-Cache and CWP Cage at no extra cost with all CWPpro licences. The LSAPI-Cache plugin is integrated into our WordPress and other script installers. Available now in the Edge-Latest and LTS-Stable versions. Discuss in the forum

LSPHP / Cache ›
CWP Secure KernelKernel-level protectionEvery site in its own sandbox

Every PHP site, cron job and SSH session runs in its own profile that the kernel enforces. A hacked WordPress cannot read other accounts’ files, and crypto miners and unexpected processes are stopped. Discuss in the forum

Secure Kernel ›
CWP DataCenter PanelFree for CWPpro serversAll your servers on one screen

Manage all your CWP servers from one panel: live health, every hosting account, CWP and OS updates on many servers at once, backups, SSL, firewall and Telegram alerts. Discuss in the forum

DataCenter Panel ›
CWP Backup ServerFree for CWPpro serversBackups that ransomware cannot reach

Protected backups of all your CWP servers on a separate machine. Snapshots a hosting server cannot delete, and restore of files, databases, mail and whole accounts in the admin and user panel. Discuss in the forum

Backup Server ›
WordPress ManagerIncluded & freeWordPress managed from the panel

Install, secure, update, back up and clone WordPress sites without FTP. Updates are tested on a staging clone first and applied to the live site only when they pass, with a backup taken first. Discuss in the forum

WordPress Manager ›
CWP CageIsolationEvery account in its own cage

Per-account isolation built from Linux namespaces and cgroups. A break-in or a runaway script on one site cannot reach another account, the panel or the rest of the server; resource limits per hosting package. Discuss in the forum

CWP Cage ›
Script InstallerOne-click appsWordPress, Joomla, Moodle and more in one click

CWP’s own script installer in the user panel: pick an app, choose the domain and folder, and it is live in seconds with its database and admin login created automatically. Ready for LSPHP and LSAPI-Cache. Discuss in the forum

Script Installer ›
DNS ClusterFor every control panelOne DNS cluster for all your servers

Your servers keep creating domains as usual; the zones are collected into one authoritative PowerDNS cluster you control, with DNSSEC, roles and a full activity trail. Accepts CWP, cPanel, Plesk, DirectAdmin and BIND. Discuss in the forum

DNS Cluster ›
CWP BillingFree to useBilling and support system for hosting providers

Clients, services, invoices, payments, domains, server provisioning and support tickets in one place. All gateways, server modules and registrars are free, with free migration from WHMCS, ClientExec and Blesta. Discuss in the forum

CWP Billing ›
CWPproFrom $1.49 per monthEvery CWP feature unlocked

CWPpro is the professional version of Control Web Panel: all features, unlimited accounts, the latest CWP version and security fixes first. $1.49 per month or $11.99 per year. Discuss in the forum

Get CWPpro ›

[module] Cloudflare - Simple 1-click install or uninstall

Started by MyBuddyBen, January 07, 2016, 03:46:39 PM

Previous topic - Next topic

MyBuddyBen

NOTICE: DO NOT INSTALL YET, there is an issue! Please wait for next version

This is a very fast, and easy way to one-click install Cloudflare apache module and also to remove it from the httpd.conf if you want. I'd like you to test and confirm it worked for you as it has for me.  ;D I did write this, so it's bound to have something wrong, so please look over it and see what you think.

Features:
- One-Click install or Uninstall Cloudflare from Apache
- Checks to see if Cloudflare is already installed Apache
- You will need to restart apache after installing cloudflare, do this from the CWP Dashboard.
- Restores Original Visitor's IP address to your server logs

NOTICE: DO NOT INSTALL YET, there is an issue! Please wait for next version
I just tried doing it on a new server and it REALLY messed up the apache.... :( I'm not going to go deeper in this because I think I misunderstood how this works. Basicly what you need is to install cloudflare with the mod_cloudflare.so then add the
LoadModule cloudflare_module  /usr/lib64/httpd/modules/mod_cloudflare.so
to your /usr/local/apache/conf/httpd.conf and restart apache. I was trying to install httpd-devel which I think messes it all up bad. You can read more here about installing cloudflare (https://www.cloudflare.com/resources-downloads/).

Perhaps someone can branch this code I started and make it better or perfect.


Latest Version: 1.1

Screenshots



Installation
Add this line to:
/usr/local/cwpsrv/htdocs/resources/admin/include/3rdparty.php
Quote<li><a href="index.php?module=cloudflare"><span class="icon16 icomoon-icon-arrow-right-3"></span>Cloudflare</a></li>



Then create a new file called "cloudflare.php" on:
/usr/local/cwpsrv/htdocs/resources/admin/modules
with this content:
Quote
<center><h2>Cloudflare Apache Module Installer</h2><h3>Version: 1.1</h3><a href="http://forum.centos-webpanel.com/new-modules/(module)-cloudflare-simple-1-click-install-or-uninstall/" target="_blank"><button type="button" class="btn btn-primary">Check for Update</button></a><hr></center>
<?php
$file = '/usr/local/apache/conf/httpd.conf';
$searchfor = 'LoadModule cloudflare_module  /usr/lib64/httpd/modules/mod_cloudflare.so';

// get the file contents, assuming the file to be readable (and exist)
$contents = file_get_contents($file);
// escape special characters in the query
$pattern = preg_quote($searchfor, '/');
// finalise the regular expression, matching the whole line
$pattern = "/^.*$pattern.*\$/m";
// search, and store all matching occurences in $matches
if(preg_match_all($pattern, $contents, $matches)){
   echo "<p class='text-success'>Cloudflare is installed already!</p>\n
   <form action='' method='post'>
<button type='submit' name='uninstall' class='btn btn-danger'>Uninstall Cloudflare</button>
</form>
   ";
}
else{
   echo "
    <center><strong>Run these commands as root in SSH terminal</strong></center>
    <pre>
mkdir /usr/local/cwpsrv/htdocs/resources/admin/modules/cloudflare
cd /usr/local/cwpsrv/htdocs/resources/admin/modules/cloudflare
wget https://www.cloudflare.com/static/misc/mod_cloudflare/mod_cloudflare.c
apxs -a -i -c mod_cloudflare.c
   </pre>
   
   Then click the green button below; then afterward go to the CWP Dashboard and Restart Apache
   
   <p class='text-success'>Cloudflare is not installed!</p>\n
   
   <form action='' method='post'>
<button type='submit' name='install' class='btn btn-success'>Install Cloudflare</button>
</form>";
}

?>
<?php
if(isset($_POST['install']))
{

//Add Cloudflare module to Apache
$path_to_file = '/usr/local/apache/conf/httpd.conf';
$file_contents = file_get_contents($path_to_file);
$file_contents = str_replace("# LoadModule foo_module modules/mod_foo.so","# LoadModule foo_module modules/mod_foo.so \nLoadModule cloudflare_module  /usr/lib64/httpd/modules/mod_cloudflare.so",$file_contents);
file_put_contents($path_to_file,$file_contents);
echo "<center><h4>Go to CWP Dashboard and Restart Apache!</h4></center><br><br>
<h5>Refreshing page in 5 seconds to verify Cloudflare was installed.....</h5>
<meta http-equiv='refresh' content='5' />";

}

if(isset($_POST['uninstall']))
{

//Remove Cloudflare module to Apache
$path_to_file = '/usr/local/apache/conf/httpd.conf';
$file_contents = file_get_contents($path_to_file);
$file_contents = str_replace("LoadModule cloudflare_module  /usr/lib64/httpd/modules/mod_cloudflare.so","",$file_contents);
file_put_contents($path_to_file,$file_contents);
echo "<center><h4>Go to CWP Dashboard and Restart Apache!</h4></center><br><br>
<h5>Refreshing page in 3 seconds to verify Cloudflare was uninstalled.....</h5>
<meta http-equiv='refresh' content='3' />";

}
?>
Trying to help people :)
Chords and Lyrics


indteam


Manoel

I would love to use this module, is expected to be able to use it?

:)

vxdas

httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2017-07-21 14:27:14 EDT; 2s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 15689 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 15687 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 15687 (code=exited, status=1/FAILURE)

I have this error and it does not start me apache.can help me

yokowasis

Quote from: vxdas on July 21, 2017, 06:29:24 PM
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2017-07-21 14:27:14 EDT; 2s ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 15689 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 15687 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 15687 (code=exited, status=1/FAILURE)

I have this error and it does not start me apache.can help me

Well, he did say, do not Install it in a RED BIG FONT. Probably because the module break or something.

MyBuddyBen

Fixed method and I believe it works with these new changes.
ONLY KNOWN TO WORK WITH APACHE SERVER.. Unsure with APACHE + NGNIX or VARNISH.
But I know it works with just plain Apache selected as the webserver..

I wish I could modify my first post, but the moderators here don't allow you to edit old posts, even if you're the creator. Not a good thing in my opinion for stuff like this that needs updating.

Updated on 04/04/2019

How to install


---FTP method:


1) Upload cloudflare.php to CWP server in /usr/local/cwpsrv/htdocs/resources/admin/modules

Download cloudflare.php:  https://cwpaddons.b-cdn.net/install/cloudflare.php

2) Open URL: yourdomain.tld/admin/index.php?module=cloudflare
3) Click the Install button

---Console method:

1) cd /usr/local/cwpsrv/htdocs/resources/admin/modules
2) wget -O cloudflare.php https://cwpaddons.b-cdn.net/install/cloudflare.php
3) Open Url: yourdomain.tld/admin/index.php?module=cloudflare
4) Click "Install" button
Trying to help people :)
Chords and Lyrics

cotlasweb

Hello,
I have installed it on my server, but how do i enable it on any website or domain and how can any user on my server enable it for his domain or website ? like the do i cpanel...? clicking cloudflare to enable for thier website..