apache每两个小时重启问题
今天遇到一个问题,发现cpanel主机上apache每两个小时重启一次,在apache error_log的记录就是:
[notice] Graceful restart requested, doing restart, 开始以为是什么计划任务造成的,找了crontab和cpanel cron job都没有问题,网上一查,原来是apache log的问题:
这里详细讲述了解决方案: http://kb.liquidweb.com/how-and-why-enabling-apaches-piped-logging/
简述步骤:
查看cpanel和apache版本:
Cpanel 需要 11.25.0-R43471 或以后
Apache 需要2 或以后
查看cpanel版本:
cat /usr/local/cpanel/version
查看apache版本:
/usr/local/apache/bin/httpd –v
备份apache httpd.conf配置:
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.prepipedlogging
修改/var/cpanel/cpanel.config,添加此行:
enable_piped_logs=1
让cpanel加载此修改:
/usr/local/cpanel/whostmgr/bin/whostmgr2 –updatetweaksettings
重新编译apache配置(这个是cpanel的功能,依据cpanel配置生成apache配置)
/scripts/rebuildhttpdconf
重启apache
/etc/init.d/httpd stop
/etc/init.d/httpd start
这就可以了。