Skip to content

Instantly share code, notes, and snippets.

@xyzulu
xyzulu / whmcs-nginx-include-rules.conf
Last active April 3, 2025 15:33 — forked from Bharat-B/readydedis.com.conf
nGINX rewrite rules for whmcs 8
location ~ /clients/admin/(client!\.php|client/(.*)|table/(.*)|search!\.php|search/(.*)|apps|billing|setup|user|services|addons|domains|utilitiesemailmarketer!\.php|utilities/(.*)|logs|help!\.php|help/license|modules|image/(recent|upload)|validation_com/(.*))/?(.*)$ {
rewrite ^/(.*)$ /clients/admin/index.php?rp=/admin/$1/$2;
}
location ~ /clients/(images/em|invoice|domain|login|invite|password|account|store|download|knowledgebase|announcements|clientarea/ssl-certificates|user/(verification|accounts|profile|password|security|verify)|cart/(domain/renew)|domain/pricing|cart/order|images/kb)/?(.*)$ {
rewrite ^/(.*)$ /clients/index.php?rp=/$1/$2;
}
location ~ /clients/auth/manage/client/links/?(.*)$ {
rewrite ^/(.*)$ /clients/index.php?rp=/auth/manage/client/links$1;
#!/bin/bash
LOG_USER_DIR="/var/www"
LOG_SERVER_DIR="/var/log"
TRUNC_USER_SIZE="+3M"
TRUNC_USER_BYTES=3145728
TRUNC_SERVER_SIZE="+50M"
TRUNC_SERVER_BYTES=52428800
JOURNAL_RETENTION_DAYS=10
POSTFIX_LOG="/var/log/postfix.log"
@xyzulu
xyzulu / MyISAM convert to InnoDB
Last active March 12, 2025 03:09
Find all MyISAM database tables and output the .sql needed to convert them to InnoDB
# You will need to login to mysql/mariadb (possibly as root user, or a user with access to all databases) first, usually: mysql
SELECT CONCAT('ALTER TABLE ',TABLE_SCHEMA,'.', table_name, ' ENGINE=InnoDB;') AS sql_statements
FROM information_schema.tables
WHERE TABLE_SCHEMA NOT IN ('mysql', 'information_schema', 'performance_schema', 'innodb', 'sys', 'tmp')
AND ENGINE = 'MyISAM'
AND TABLE_TYPE = 'BASE TABLE'
ORDER BY TABLE_SCHEMA, table_name DESC;
@xyzulu
xyzulu / setup-wordpress.sh
Last active March 31, 2025 23:52
default site setup
#!/bin/bash
wp language core install en_AU
wp site switch-language en_AU
wp rewrite structure '/%postname%/'
wp option update timezone_string "Australia/Sydney"
wp option set blog_public 0
wp theme install hello-elementor
wp theme install https://github.com/elementor/hello-theme-child/archive/refs/heads/master.zip --activate
wp plugin install postmark-approved-wordpress-plugin --activate
@xyzulu
xyzulu / enhance_control_backup.sh
Last active March 26, 2025 19:13
Backup Enhance control panel server assets that are needed in the event of a server disaster
#!/bin/bash
##############################################################################
# At the least you will need to set the remote transfer credentials and paths.
# This script will keep 14 days of backups on your destination host.
##############################################################################
TEMP_DIR="/temp"
TIMESTAMP=$(date +%Y%m%d%H%M%S)
ARCHIVE_NAME="$TEMP_DIR/control-backup_$TIMESTAMP.tar.gz"
@xyzulu
xyzulu / cpfence_backup.sh
Last active March 16, 2025 02:47
Backup cPFence settings to a remote location and then delete the backup file
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
# Configuration
REMOTE_USER="your_user"
REMOTE_HOST="your_remote_host"
REMOTE_DIR="/path/to/remote/destination"
@xyzulu
xyzulu / ioncube_loaders_update.sh
Last active April 25, 2025 00:49
Update/download the latest version of ioncube loaders and update them in /usr/local/ioncube
#!/bin/bash
IONCUBE_DIR="/usr/local/ioncube"
REFERENCE_FILE="$IONCUBE_DIR/loader-wizard.php"
TMP_DIR="/tmp/ioncube_update"
LATEST_URL="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz"
echo "Updating ionCube Loaders..."
# Ensure the reference file exists