cPanel is a popular control panel for web hosting services. However, you may encounter performance issues while using cPanel. In this article, we will provide step-by-step solutions to enhance the performance of a server running cPanel.
Source of Performance Issues
cPanel hosts many resource-intensive processes. In particular, MySQL queries, PHP processes, and Apache configurations often cause issues on high-traffic websites. Therefore, optimization is crucial.
Step 1: Connect to Server via SSH
First, connect to your server via SSH:
ssh root@server_ip_address
Step 2: MySQL Optimization
Optimizing the MySQL database is essential for improving performance. Follow these steps:
To optimize the Apache server, follow these steps:
Edit httpd.conf File
Open the Apache configuration file:
nano /etc/httpd/conf/httpd.conf
Add the following parameters:
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
Save the changes and restart the Apache service:
systemctl restart httpd
Step 4: Install LiteSpeed
Using LiteSpeed instead of Apache can enhance performance. To install LiteSpeed, use the following commands:
cd /usr/local/src
wget https://www.litespeedtech.com/packages/openlitespeed.tar.gz
tar -zxvf openlitespeed.tar.gz
cd openlitespeed
./install.sh
After configuring LiteSpeed, start the service:
/usr/local/lsws/bin/lswsctrl start
Step 5: Adding DDoS Protection
To protect against DDoS attacks, follow these steps:
iptables -A INPUT -p tcp --dport 80 -m limit --limit 25/minute --limit-burst 100 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j DROP
Conclusion
By following the steps above, you can significantly enhance the performance of your server running cPanel. Each step will help you utilize your system resources more efficiently.