Respect Selected Webserver Mode

This commit is contained in:
earnolmartin 2023-10-23 16:05:44 -06:00
parent b20745dfd4
commit 72dfd235ae
2 changed files with 24 additions and 5 deletions

View file

@ -102,7 +102,7 @@ if($webServerToInstall == "nginx" || ((isset($version) && $version != "12.10" &&
} }
# scandb(); no more need to scan db since ver. 0.29.15 # scandb(); no more need to scan db since ver. 0.29.15
installfinish(); installfinish($webServerToInstall);
$message=''; $message='';
exec('ifconfig',$msg); exec('ifconfig',$msg);

View file

@ -1275,6 +1275,8 @@ function rebuild_nginx_config2($mydir){
$phpFPMVersion = "php5-fpm"; $phpFPMVersion = "php5-fpm";
} }
manageService($phpFPMVersion, "restart"); manageService($phpFPMVersion, "restart");
manageService("nginx", "restart");
} }
function install_nginx_webserver(){ function install_nginx_webserver(){
@ -1318,6 +1320,7 @@ function install_nginx_webserver(){
manageService("nginx", "restart"); manageService("nginx", "restart");
// Stop and disable services // Stop and disable services
manageService("apache2", "stop");
$app->disableService("apache2"); $app->disableService("apache2");
$app->enableService("nginx"); $app->enableService("nginx");
$app->enableService($phpFPMVersion); $app->enableService($phpFPMVersion);
@ -1947,7 +1950,7 @@ function install_with_mode($params){ # complete later.
} }
} }
function installfinish() { function installfinish($webServerToInstall) {
global $ehcpinstalldir,$ehcpmysqlpass,$app,$user_email,$user_name,$header,$installextrasoftware,$lightinstall,$installmode; global $ehcpinstalldir,$ehcpmysqlpass,$app,$user_email,$user_name,$header,$installextrasoftware,$lightinstall,$installmode;
switch($installmode) { switch($installmode) {
@ -1994,7 +1997,11 @@ function installfinish() {
writeoutput("/var/www/index.html",$filecontent);*/ writeoutput("/var/www/index.html",$filecontent);*/
echo "\nPlease wait while services restarting...\n\n"; echo "\nPlease wait while services restarting...\n\n";
manageService("apache2", "restart"); if($webServerToInstall == "nginx"){
manageService("nginx", "restart");
}else{
manageService("apache2", "restart");
}
manageService("bind9", "restart"); manageService("bind9", "restart");
manageService("postfix", "restart"); manageService("postfix", "restart");
passthru("cp /etc/apt/sources.list.bck.ehcp /etc/apt/sources.list"); passthru("cp /etc/apt/sources.list.bck.ehcp /etc/apt/sources.list");
@ -2009,8 +2016,20 @@ function installfinish() {
sleep(2); sleep(2);
manageService("mysql", "restart"); manageService("mysql", "restart");
sleep(1); sleep(1);
passthru2("update-rc.d -f nginx remove");
passthru2("update-rc.d apache2 defaults"); $phpFPMVersion = $app->getPHPFPMName();
if($phpFPMVersion === false){
$phpFPMVersion = "php5-fpm";
}
if($webServerToInstall == "nginx"){
$app->disableService("apache2");
$app->enableService("nginx");
}else{
$app->disableService("nginx");
$app->enableService("apache2");
}
manageService("apparmor", "stop"); manageService("apparmor", "stop");
// passthru("cd /var/www/ehcp"); // passthru("cd /var/www/ehcp");