Self-Hosted cPanel
A cPanel/WHM server that powers this site and my lab projects. Focused on predictable migrations, backups, and SSL.
Self-hosted
What I run
- Rocky Linux + cPanel/WHM with AutoSSL and scheduled backups.
- Separate staging and production vhosts, clean URLs, and redirects.
- Tuned PHP-FPM, log rotation, and basic WAF rules.
- Migration playbook: pre-checks → snapshot/backup → cutover → post-checks.
Snippets
Backup and restore a single account (root shell):
# Package an account (on source)
# (Run as root on a cPanel server)
/scripts/pkgacct username
# Copy the archive to target and restore
# (Run as root on the target cPanel server)
/scripts/restorepkg /home/cpmove-username.tar.gz
AutoSSL (ensure it’s enabled + run now):
# Enable AutoSSL for all users (WHM UI recommended)
# Force a run from CLI:
/usr/local/cpanel/bin/autossl_check --all-users
Pre-migration content sync (non-cPanel source → cPanel target):
# Example rsync (first pass); adjust paths/users/hostnames
rsync -aHAX --info=progress2 --delete /var/www/html/ root@cpanel-target:/home/USER/public_html/
I keep a short runbook (checks, rollbacks, DNS/SSL steps) so I can repeat migrations safely.