How to Install cPGuard on an xCloud Server

Updated November 24, 2026 · 12 min read

Summarize with:
Share:

xCloud does not support cPGuard natively. There is no cPGuard button in the dashboard, and our support team cannot install or troubleshoot it for you. But you have root access to every xCloud server, so you can install the standalone version yourself over SSH. This guide gives the exact commands and the settings that keep xCloud working next to it.

We tested these steps on 24 November 2026 with cPGuard 5.91.09 on Ubuntu 24.04, on one xCloud server running Nginx 1.31.10 and one running OpenLiteSpeed 1.9.4, each with WordPress sites.

What works and what needs care

cPGuard part Result on xCloud
Malware scanner Works on Nginx and OpenLiteSpeed. Finds files on demand and in real time.
Firewall (IP blocklist) Works next to xCloud’s firewall (UFW) and Fail2Ban.
Login bans (LFD) Works. Stricter than Fail2Ban: it bans an IP after 3 failed SSH logins in a minute. Allow xCloud’s IPs first (Step 5).
Port filter Leave it off. It blocks ports you open in xCloud and several outbound ports.
WAF Optional and manual. On OpenLiteSpeed you must add it again after installing a PHP version. On Nginx you must rebuild a module after every Nginx upgrade.

Before you begin

Every command below runs as root.

Step 1: Open a terminal on the server

In xCloud, open ‘Servers’ and select your server. Click ‘Open Terminal’ at the top right. A root shell opens in your browser.

Click ‘Open Terminal’ on the server page in xCloud to open a root terminal

Step 2: Tell cPGuard where your sites are

cPGuard has no xCloud profile, so it cannot find your sites by itself. xCloud keeps every site in its own folder under /var/www. This small script lists those folders in the format cPGuard reads.

Create the script:

cat > /usr/local/bin/cpguard-site-list <<'EOF'
#!/bin/bash
# Lists every site folder under /var/www for cPGuard.
sep=""
printf '['
for dir in /var/www/*/; do
  dir="${dir%/}"
  name="$(basename "$dir")"
  [ "$name" = "html" ] && continue
  user="$(stat -c %U "$dir")"
  [ "$user" = "root" ] && continue
  printf '%s{"domain":"%s","docroot":"%s/","user":"%s"}' "$sep" "$name" "$dir" "$user"
  sep=","
done
printf ']\n'
EOF
chmod 755 /usr/local/bin/cpguard-site-list

Run it once to check the output. You should see one entry per site:

/usr/local/bin/cpguard-site-list

Then create the cPGuard settings file that points to the script:

cat > /root/cpguard.ini <<'EOF'
domain_list = /usr/local/bin/cpguard-site-list
EOF

Step 3: Install cPGuard

Replace LICENSE-KEY with your own key:

cd /usr/local/src
curl -o cpguard_install.sh -L https://downloads.opsshield.com/cpguard/cpguard_install.sh
bash cpguard_install.sh LICENSE-KEY /root/cpguard.ini

The installer takes about a minute. It prints “No supported control panel was found. Using standalone profile”, then a summary. Every line in the summary should say Pass.

The installer makes these changes to your server:

  • It adds three rules to xCloud’s firewall (UFW) so OPSSHIELD’s App Portal can reach port 9098.
  • It installs its own small web server under /opt/cpguard, separate from your Nginx or OpenLiteSpeed.
  • It leaves UFW, Fail2Ban and your web server configuration as they were.

If you see “Provided key is not valid”, the key is already used on another server.

Step 4: Check that everything still works

cpgcli license --status
systemctl is-active ufw fail2ban

The first command should end with “License is valid”. The second should print active twice. Open one of your sites in a browser, and check in xCloud that the server still shows as connected.

Step 5: Allow xCloud’s IP addresses

cPGuard bans an IP address on every port after 3 failed SSH logins in one minute. xCloud connects to your server often, so add its IP addresses to cPGuard’s allow list before you turn anything else on:

cpgcli ip --allow $(curl -s https://app.xcloud.host/ips | tr '\n' ' ') --reason "xCloud"
cpgcli ip --allow --list

The second command should list every address from app.xcloud.host/ips. Add your own office or home IP the same way, so you cannot lock yourself out:

cpgcli ip --allow 203.0.113.10 --reason "My office"

For the full list of what must stay open, see Lock down your server without breaking xCloud.

Step 6: Scan your sites

Start a scan of every site:

cpgcli scan --all --no-wait

Then list the scans and read the result. Replace 1 with the ID from the list:

cpgcli scan --list
cpgcli scan --result 1

By default cPGuard only reports what it finds. It does not delete or change files. To move infected files out of a site during a scan, add the quarantine action:

cpgcli scan --path /var/www/example.com --virus-action quarantine

Quarantined files go to /etc/cpguard/quarantine.

The real-time scanner starts by itself a minute or two after the install. Check it with:

cpgcli scanner --status
cpgcli watch --all

cpgcli watch --all lists the site folders the scanner watches.

After you create a new site

cPGuard does not notice a new site by itself. After you create a site in xCloud, restart the scanner so it reads the site list again:

cpgcli scanner --restart
cpgcli watch --all

The new site’s folder should now be in the list.

Step 7: Turn on the firewall

cpgcli fw --enable

cPGuard’s firewall blocks IP addresses from its own blocklist. It sits in front of UFW and does not replace it. Rules you add in xCloud under Security → Firewall Management keep working.

Do not turn on the port filter (cpgcli fw --port-filter enable). With it on, cPGuard decides which ports are open and ignores the ones you open in xCloud. In our test it blocked a port opened from the xCloud dashboard, and it blocked outbound connections to SMTP on port 465, remote MySQL on 3306 and Redis on 6379. If your server uses a custom SSH port, the port filter can also cut xCloud off from the server.

If you turned it on by mistake:

cpgcli fw --port-filter disable

Optional: Turn on the WAF on OpenLiteSpeed

cPGuard’s WAF needs ModSecurity. xCloud does not install ModSecurity, and cPGuard does not install it either, so you add it yourself.

1. Install the ModSecurity module:

apt-get install -y ols-modsecurity

2. Add the module to OpenLiteSpeed’s configuration:

cat >> /usr/local/lsws/conf/httpd_config.conf <<'EOF'

module mod_security {
modsecurity  on
modsecurity_rules `
SecRuleEngine On
SecAuditEngine RelevantOnly
SecAuditLog /usr/local/lsws/logs/modsec_audit.log
SecAuditLogParts ABDEFHIJZ
SecAuditLogType Serial
`
modsecurity_rules_file /usr/local/lsws/conf/cpguard.conf
ls_enabled              1
}
EOF

3. Tell cPGuard about the web server, then turn the WAF on:

cat >> /opt/cpguard/cpguard.ini <<'EOF'
waf_server = openlitespeed
waf_server_conf = /usr/local/lsws/conf/cpguard.conf
waf_server_restart_cmd = /usr/local/lsws/bin/lswsctrl restart
waf_audit_log = /usr/local/lsws/logs/modsec_audit.log
waf_server_error_log = /usr/local/lsws/logs/error.log
EOF
cpgcli standalone-conf --update
cpgcli waf --enable

cPGuard restarts OpenLiteSpeed and sends a test attack. It also adds one line of its own to the module block. That is expected.

4. Test it. Replace SERVER_IP with your server’s IP address:

curl -s -o /dev/null -w "%{http_code}\n" "http://SERVER_IP/?malware_expert_test_rule"

The command should print 403. Your sites should still load normally.

Add the module again after installing a PHP version

When you install a PHP version from the xCloud dashboard, xCloud rewrites httpd_config.conf and the module mod_security block is removed. The WAF then stops without any warning, and the test above prints 200. After every PHP version install, repeat sub-step 2 and run cpgcli waf --enable again. Creating a new site does not remove the block.

Optional: Turn on the WAF on Nginx

This part is for experienced users. xCloud runs the official nginx.org build of Nginx, and Ubuntu’s ModSecurity package cannot be installed next to it. You have to compile the ModSecurity module yourself, and rebuild it after every Nginx upgrade. Read the upgrade warning below before you start.

1. Build the module for your Nginx version:

apt-get install -y libmodsecurity-dev libmodsecurity3t64 libpcre2-dev zlib1g-dev libssl-dev
V=$(nginx -v 2>&1 | sed 's#.*/##')
mkdir -p /root/modsec-build && cd /root/modsec-build
curl -sSL -o nginx-$V.tar.gz https://nginx.org/download/nginx-$V.tar.gz
tar xzf nginx-$V.tar.gz
[ -d ModSecurity-nginx ] || git clone --depth 1 https://github.com/owasp-modsecurity/ModSecurity-nginx.git
cd nginx-$V
./configure --with-compat --add-dynamic-module=../ModSecurity-nginx
make modules
cp objs/ngx_http_modsecurity_module.so /usr/lib/nginx/modules/

The build takes under a minute.

2. Load the module and switch ModSecurity on:

echo 'load_module modules/ngx_http_modsecurity_module.so;' > /etc/nginx/modules-enabled/60-modsecurity.conf
mkdir -p /etc/nginx/modsec
touch /etc/nginx/modsec/cpguard.conf /var/log/nginx/modsec_audit.log
cat > /etc/nginx/modsec/main.conf <<'EOF'
SecRuleEngine On
SecAuditEngine RelevantOnly
SecAuditLog /var/log/nginx/modsec_audit.log
SecAuditLogParts ABDEFHIJZ
SecAuditLogType Serial
Include /etc/nginx/modsec/cpguard.conf
EOF
printf 'modsecurity on;\nmodsecurity_rules_file /etc/nginx/modsec/main.conf;\n' > /etc/nginx/conf.d/00-modsecurity.conf
nginx -t && systemctl reload nginx

nginx -t must print “test is successful” before you continue.

3. Tell cPGuard about the web server, then turn the WAF on:

cat >> /opt/cpguard/cpguard.ini <<'EOF'
waf_server = nginx
waf_server_conf = /etc/nginx/modsec/cpguard.conf
waf_server_restart_cmd = /bin/systemctl restart nginx
waf_audit_log = /var/log/nginx/modsec_audit.log
waf_server_error_log = /var/log/nginx/error.log
EOF
cpgcli standalone-conf --update
cpgcli waf --enable

4. Test it. Replace SERVER_IP with your server’s IP address:

curl -s -o /dev/null -w "%{http_code}\n" "http://SERVER_IP/?malware_expert_test_rule"

The command should print 403.

Rebuild the module after every Nginx upgrade

A module built for one Nginx version does not load in another. In our test, after Nginx changed version:

  • nginx -t failed with “module ngx_http_modsecurity_module.so version 1031009 instead of 1031010”.
  • Sites kept loading at first, because the old Nginx process was still running.
  • The next Nginx restart failed, and every site on the server went down. A server reboot does the same.

So after any Nginx upgrade, run sub-step 1 again right away, then:

nginx -t && systemctl restart nginx

If Nginx is already down, switch ModSecurity off to get your sites back, then rebuild in your own time:

mkdir -p /root/modsec-off
mv /etc/nginx/modules-enabled/60-modsecurity.conf /etc/nginx/conf.d/00-modsecurity.conf /root/modsec-off/
nginx -t && systemctl restart nginx

Your sites load again, without the WAF. After you rebuild the module, move the two files back and restart Nginx.

Make Magic Login work with the WAF

With the WAF on, cPGuard shows a “Confirming you are human” captcha in front of wp-login.php. xCloud’s Magic Login uses that address, so it lands on the captcha page too.

To remove the captcha and keep the rest of the WAF:

cpgcli waf --disable captcha

Wait about 20 seconds, then try Magic Login again. It should open the WordPress dashboard.

How to uninstall cPGuard

cd /usr/local/src
curl -o cpguard_uninstall.sh -L https://downloads.opsshield.com/cpguard/cpguard_uninstall.sh
bash cpguard_uninstall.sh

The uninstaller removes cPGuard, its firewall rules and the license from this server. It leaves a few things behind. Clean them up:

Remove the three App Portal rules from UFW:

for ip in 137.184.200.210 159.89.87.35 167.99.149.179; do
  ufw delete allow from $ip to any proto tcp port 9098
done

If you turned on the WAF on OpenLiteSpeed:

sed -i '/^module mod_security {/,/^}/d' /usr/local/lsws/conf/httpd_config.conf
rm -f /usr/local/lsws/conf/cpguard.conf
/usr/local/lsws/bin/lswsctrl restart

If you turned on the WAF on Nginx:

rm -f /etc/nginx/modules-enabled/60-modsecurity.conf /etc/nginx/conf.d/00-modsecurity.conf
rm -rf /etc/nginx/modsec
nginx -t && systemctl restart nginx

Then remove the site list script:

rm -f /usr/local/bin/cpguard-site-list /root/cpguard.ini

Troubleshooting

Problem Likely cause Fix
An IP address cannot reach the server at all cPGuard banned it after failed logins cpgcli ip --check IP shows the reason. Add trusted addresses with cpgcli ip --allow IP.
A port you opened in xCloud is still closed The port filter is on cpgcli fw --port-filter disable
Sites cannot send email or reach a remote database The port filter is on cpgcli fw --port-filter disable
A new site is not scanned in real time The scanner has not read the site list again cpgcli scanner --restart
The WAF test prints 200 on OpenLiteSpeed A PHP version install removed the module block Add the block again and run cpgcli waf --enable
nginx -t fails with a module version error Nginx was upgraded Rebuild the module, or move the two ModSecurity files away
Magic Login shows a captcha cPGuard’s captcha module cpgcli waf --disable captcha

What xCloud already includes

Before you add a third-party tool, check what your server already has. xCloud manages these for you, with no manual upkeep:

Frequently asked questions

Does xCloud support cPGuard?

Not natively. xCloud does not install, update or troubleshoot cPGuard. You get root access to your server, so you can install and manage it yourself with the steps in this guide.

Will cPGuard break my xCloud server?

The malware scanner and the firewall ran alongside xCloud in our test without problems. The port filter and the WAF need care: the port filter blocks ports xCloud opens for you, and on Nginx the WAF module must be rebuilt after every Nginx upgrade.

Why does Magic Login show a ‘Confirming you are human’ page?

cPGuard’s WAF puts a captcha in front of wp-login.php, and Magic Login uses that address. Turn off cPGuard’s captcha module to remove the captcha and keep the rest of the WAF. The command is in this guide.

Do I need cPGuard on xCloud at all?

Not for the basics. xCloud already includes a server firewall, Fail2Ban, the 7G and 8G firewalls, a vulnerability checker and checksum verification. cPGuard adds a server-wide malware scanner and its own IP blocklist.