Apache2 - reload instead restart (idea)
Hi guys,
I looked inside the source code today, because our webserver with many websites got some seconds of offtime after changing website configurations. So I debugged a little and saw, that the apache2-plugin do a restart and tcp check to test out, if configs are faulty. In my opinion this is unnecessary, because it could be tested by apache2ctl -t before, OR doing a reload which results in a fail, which will result in an error too, but needs less time.
if($web_config['check_apache_config'] == 'y') {
//* Test if apache starts with the new configuration file
$apache_online_status_before_restart = $this->_checkTcp('localhost', 80);
$app->log('Apache status is: '.($apache_online_status_before_restart === true? 'running' : 'down'), LOGLEVEL_DEBUG);
===> $retval = $app->services->restartService('httpd', 'restart'); // $retval['retval'] is 0 on success and > 0 on failure
$app->log('Apache restart return value is: '.$retval['retval'], LOGLEVEL_DEBUG);
Why to do something like that? Wouldn't it be better to reload, and check for errors then? So existing websites would not get an offtime while ispconfig will fix the faulty config files. I tested with reload and it worked so far. The correct workflow should be a testing via "apache2ctl -t" before, then reload, shouldn't it?
I think this is not a bug, but should be rethought in newer versions. So far we will patch that files atm.