From 194edf99c9baad556f111ea8475951496e0c4c38 Mon Sep 17 00:00:00 2001 From: Thom Pol Date: Sun, 31 Jan 2021 21:41:10 +0100 Subject: [PATCH] Use standard_index.html as filename for the template index file (#5897) --- install/tpl/apache_ispconfig.conf.master | 1 + server/conf/nginx_vhost.conf.master | 2 +- server/plugins-available/apache2_plugin.inc.php | 16 ++++++++-------- server/plugins-available/nginx_plugin.inc.php | 16 +++++++++------- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/install/tpl/apache_ispconfig.conf.master b/install/tpl/apache_ispconfig.conf.master index b1de2a1676..2a7ac0662e 100644 --- a/install/tpl/apache_ispconfig.conf.master +++ b/install/tpl/apache_ispconfig.conf.master @@ -3,6 +3,7 @@ ################################################ ServerTokens ProductOnly ServerSignature Off +DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm standard_index.html ################################################ # ISPConfig Logfile configuration for vlogger diff --git a/server/conf/nginx_vhost.conf.master b/server/conf/nginx_vhost.conf.master index f2b3e0f833..a3b14a58fa 100644 --- a/server/conf/nginx_vhost.conf.master +++ b/server/conf/nginx_vhost.conf.master @@ -79,7 +79,7 @@ server { - index index.html index.htm index.php index.cgi index.pl index.xhtml; + index index.html index.htm index.php index.cgi index.pl index.xhtml standard_index.html; location ~ \.shtml$ { diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php index 26cd14fd36..45594da5f1 100644 --- a/server/plugins-available/apache2_plugin.inc.php +++ b/server/plugins-available/apache2_plugin.inc.php @@ -953,11 +953,11 @@ class apache2_plugin { $app->system->exec_safe('chmod -R a+r ?', $error_page_path); } - //* Copy the web skeleton files only when there is no index.ph or index.html file yet - if(!file_exists($data['new']['document_root'].'/'.$web_folder.'/index.html') && !file_exists($data['new']['document_root'].'/'.$web_folder.'/index.php')) { + //* Copy the web skeleton files only when there is no index.php, standard_index.html or index.html file yet + if(!file_exists($data['new']['document_root'].'/'.$web_folder.'/index.html') && !file_exists($data['new']['document_root'].'/'.$web_folder.'/index.php') && !file_exists($data['new']['document_root'].'/'.$web_folder.'/standard_index.html')) { if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr($conf['language'], 0, 2))) { - if(!file_exists($data['new']['document_root'] . '/' . $web_folder . '/index.html')) { - $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf-custom/index/standard_index.html_' . substr($conf['language'], 0, 2), $data['new']['document_root'] . '/' . $web_folder . '/index.html'); + if(!file_exists($data['new']['document_root'] . '/' . $web_folder . '/standard_index.html')) { + $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf-custom/index/standard_index.html_' . substr($conf['language'], 0, 2), $data['new']['document_root'] . '/' . $web_folder . '/standard_index.html'); } if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) { @@ -968,13 +968,13 @@ class apache2_plugin { } } else { if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) { - if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/index.html')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf-custom/index/standard_index.html', $data['new']['document_root'].'/' . $web_folder . '/index.html'); + if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/standard_index.html')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf-custom/index/standard_index.html', $data['new']['document_root'].'/' . $web_folder . '/standard_index.html'); } else { - if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/index.html')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf/index/standard_index.html_'.substr($conf['language'], 0, 2), $data['new']['document_root'].'/' . $web_folder . '/index.html'); - if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')){ + if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/standard_index.html')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf/index/standard_index.html_'.substr($conf['language'], 0, 2), $data['new']['document_root'].'/' . $web_folder . '/standard_index.html'); + if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')) { if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/favicon.ico')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf/index/favicon.ico', $data['new']['document_root'].'/' . $web_folder . '/'); } - if(is_file($conf['rootpath'] . '/conf/index/robots.txt')){ + if(is_file($conf['rootpath'] . '/conf/index/robots.txt')) { if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/robots.txt')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf/index/robots.txt', $data['new']['document_root'].'/' . $web_folder . '/'); } } diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php index 73e788ed43..62a618ce7f 100644 --- a/server/plugins-available/nginx_plugin.inc.php +++ b/server/plugins-available/nginx_plugin.inc.php @@ -791,10 +791,12 @@ class nginx_plugin { $app->system->exec_safe('chmod -R a+r ?', $error_page_path); } - //* Copy the web skeleton files only when there is no index.ph or index.html file yet - if(!file_exists($data['new']['document_root'].'/'.$web_folder.'/index.html') && !file_exists($data['new']['document_root'].'/'.$web_folder.'/index.php')) { + //* Copy the web skeleton files only when there is no index.php, standard_index.html or index.html file yet + if(!file_exists($data['new']['document_root'].'/'.$web_folder.'/index.html') && !file_exists($data['new']['document_root'].'/'.$web_folder.'/index.php') && !file_exists($data['new']['document_root'].'/'.$web_folder.'/standard_index.html')) { if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr($conf['language'], 0, 2))) { - if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/index.html')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf-custom/index/standard_index.html_'.substr($conf['language'], 0, 2), $data['new']['document_root'].'/' . $web_folder . '/index.html'); + if(!file_exists($data['new']['document_root'] . '/' . $web_folder . '/standard_index.html')) { + $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf-custom/index/standard_index.html_' . substr($conf['language'], 0, 2), $data['new']['document_root'] . '/' . $web_folder . '/standard_index.html'); + } if(is_file($conf['rootpath'] . '/conf-custom/index/favicon.ico')) { if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/favicon.ico')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf-custom/index/favicon.ico', $data['new']['document_root'].'/' . $web_folder . '/'); @@ -804,13 +806,13 @@ class nginx_plugin { } } else { if (file_exists($conf['rootpath'] . '/conf-custom/index/standard_index.html')) { - if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/index.html')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf-custom/index/standard_index.html', $data['new']['document_root'].'/' . $web_folder . '/index.html'); + if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/standard_index.html')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf-custom/index/standard_index.html', $data['new']['document_root'].'/' . $web_folder . '/standard_index.html'); } else { - if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/index.html')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf/index/standard_index.html_'.substr($conf['language'], 0, 2), $data['new']['document_root'].'/' . $web_folder . '/index.html'); - if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')){ + if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/standard_index.html')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf/index/standard_index.html_'.substr($conf['language'], 0, 2), $data['new']['document_root'].'/' . $web_folder . '/standard_index.html'); + if(is_file($conf['rootpath'] . '/conf/index/favicon.ico')) { if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/favicon.ico')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf/index/favicon.ico', $data['new']['document_root'].'/' . $web_folder . '/'); } - if(is_file($conf['rootpath'] . '/conf/index/robots.txt')){ + if(is_file($conf['rootpath'] . '/conf/index/robots.txt')) { if(!file_exists($data['new']['document_root'].'/' . $web_folder . '/robots.txt')) $app->system->exec_safe('cp ? ?', $conf['rootpath'] . '/conf/index/robots.txt', $data['new']['document_root'].'/' . $web_folder . '/'); } } -- GitLab