How to debug CyberPanel properly
A comprehensive guide to properly debugging CyberPanel issues using various log files and diagnostic commands.
Debugging CyberPanel issues effectively requires understanding the various log files and diagnostic tools available. This guide will walk you through the proper debugging process step by step.
Enable Debug Mode
First, please execute the following command to enable additional debug logging:
touch /usr/local/CyberCP/debug
This command will initiate the generation of additional debug logs. If you encounter any issues with CyberPanel, you can run this command and subsequently capture the output from /home/cyberpanel/error-logs.txt
.
LiteSpeed Web Server Logs
Error Logs
Try the following commands to gather more information about errors:
cat /usr/local/lsws/logs/error.log | grep "your IP or domain or whatever you wish to debug"
Alternatively, you can monitor errors in real-time using:
tail -f /usr/local/lsws/logs/error.log
While executing the steps that are causing the issue.
Access Logs
Another crucial log file to consider is:
/usr/local/lsws/logs/access.log
This log contains all HTTP requests made to your server and can help identify traffic patterns and potential issues.
System Service Logs
If you do not see any relevant output in the LiteSpeed logs, you may also try:
journalctl -u lshttpd -b --no-pager
or for real-time monitoring:
journalctl -f lshttpd
These commands will show you systemd journal logs for the LiteSpeed HTTP daemon.
ModSecurity Logs
Additionally, you may find the following log important:
/usr/local/lsws/logs/auditmodsec.log
This log pertains to mod_security. I have personally encountered issues with Cyrillic letters being blocked due to mod_security rules in CyberPanel. This log will help you identify if requests are being blocked by security rules.
Upgrading CyberPanel
If all else fails, you may consider upgrading CyberPanel using the following command:
sh <(curl https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh || wget -O - https://raw.githubusercontent.com/usmannasir/cyberpanel/stable/preUpgrade.sh)
Fixing Django Import Errors
Should you receive an error during the upgrade process similar to the following:
ImportError: cannot import name 'DEFAULT_STORAGE_ALIAS' from 'django.conf' (/usr/local/lib/python3.9/site-packages/django/conf/__init__.py)
It is advisable to upgrade Django. You can perform the upgrade with the following command:
pip3 install --upgrade django
This error typically occurs when CyberPanel is trying to use Django features that are not available in the currently installed version.
Additional Debugging Tips
-
Check CyberPanel Status: Always verify that all CyberPanel services are running:
systemctl status lscpd
-
Review Recent Changes: If the issue started recently, review any recent configuration changes or updates.
-
Check Disk Space: Insufficient disk space can cause various issues:
df -h
-
Monitor Resource Usage: High resource usage might cause performance issues:
top htop
-
Check for Permission Issues: Ensure proper file permissions are set for CyberPanel directories and files.
By following this systematic approach to debugging, you should be able to identify and resolve most CyberPanel issues effectively.