Internal server error on cpanel server

Today a cpanel server start showing Internal Server error when accessing the sites. This happened for all sites.

This usually cause if log files is too big. So i cleaned all large files in apache log folder

echo > /usr/local/apache/logs/suphp_log
echo >  /usr/local/apache/logs/error_log
echo > /usr/local/apache/logs/access_log
echo > /usr/local/apache/logs/suexec_log

Cpanel should do the log rotation if we set at

Main >> Service Configuration >> cPanel Log Rotation Configuration

It look like it do not rotate all log files, in WHM, list of files to rotate, there is no suexec_log

So to remove log files, i created a shell script

vi /root/clean_log.sh

With following content

root@server82 [~]# cat clean_log.sh
#!/bin/bash

echo > /usr/local/apache/logs/suphp_log
echo >  /usr/local/apache/logs/error_log
echo > /usr/local/apache/logs/access_log
echo > /usr/local/apache/logs/suexec_log

root@server82 [~]#

Make the script executable with

chmod 755 /root/clean_log.sh

Now i set a Cronjob

57 8 * * * /root/clean_log.sh

You need to verify the script works by running the script on command line

cd /usr/local/apache/logs
ls -l
/root/clean_log.sh
ls -l

You will see size of log files got resetted.

This entry was posted in Cpanel Server and tagged , , , , . Bookmark the permalink.