You can check out the Linux Scripts project, which automates some CloudPanel improvements:
System update and installation of essential packages (before installing CloudPanel):
Updates the operating system and installs essential packages such as sudo, nano, fail2ban, and cron:
curl -fsSL https://raw.githubusercontent.com/ivancarlosti/scripts/main/linux-scripts/server-prep.sh | sudo bash
Important panel settings:
- Panel site backups: https://[domain]/admin/remote-backup
- Panel domain (default port: 8443): https://[domain]/admin/settings
- Panel time zone: https://[domain]/admin/instance/settings
- User 2FA: https://[domain]/security
- User time zone: https://[domain]/settings
Important Redis settings:
Redis recommends that the vm.overcommit_memory setting always be 1. Also, configuring a bind that is not yet available can prevent Redis from starting. You can run the lines below to add vm.overcommit_memory = 1 and net.ipv4.ip_nonlocal_bind = 1 to the /etc/sysctl.conf file and then apply the configuration by running sysctl -p:
curl -fsSL https://raw.githubusercontent.com/ivancarlosti/scripts/main/linux-scripts/redis-setup.sh | sudo bash
You can check whether Redis displays this recommendation or any other error in its log by running:
sudo tail -f /var/log/redis/redis-server.log
You can check the execution queries that reach Redis with this command:
redis-cli monitor
Disabling unused services:
This script disables PHP versions older than 7.4, as well as other unnecessary services such as memcached, postfix, and proftpd:
curl -fsSL https://raw.githubusercontent.com/ivancarlosti/scripts/main/linux-scripts/disable-services.sh | sudo bash
Main nginx configuration, including removal of the old GeoIP and updating security header rules:
Resets nginx rules, including GeoIP removal and performance and security optimizations. It usually has no impact on applications:
curl -fsSL https://raw.githubusercontent.com/ivancarlosti/scripts/main/linux-scripts/cloudpanel-fix.sh | sudo bashInstalling specific systems in CloudPanel:
For YOURLS installations, where it is necessary to change the search for index.php to yourls-loader.php, modify the try_files $uri $uri/ /index.php?$args; entry as follows:
### BEGIN custom entry for YOURLS try_files $uri $uri/ /yourls-loader.php$is_args$args; # try_files $uri $uri/ /index.php?$args; ### END custom entry for YOURLS
Done!