diff --git a/lib/Froxlor/Cron/Http/Nginx.php b/lib/Froxlor/Cron/Http/Nginx.php index 4087ec2d..7f23d653 100644 --- a/lib/Froxlor/Cron/Http/Nginx.php +++ b/lib/Froxlor/Cron/Http/Nginx.php @@ -948,7 +948,7 @@ class Nginx extends HttpConfigBase if ($row['options_indexes'] != '0') { $this->vhost_root_autoindex = true; } - $path_options .= "\t" . 'location ' . $path . ' {' . "\n"; + $path_options .= "\t" . 'location ' . FileDir::makeCorrectDir($path) . ' {' . "\n"; if ($this->vhost_root_autoindex) { $path_options .= "\t\t" . 'autoindex on;' . "\n"; $this->vhost_root_autoindex = false; @@ -974,9 +974,6 @@ class Nginx extends HttpConfigBase } else { $path_options .= "\t\t" . 'index index.html index.htm;' . "\n"; } - $path_options .= "\t\t" . 'location ~ ^(.+?\.php)(/.*)?$ {' . "\n"; - $path_options .= "\t\t\t" . 'try_files ' . $domain['nonexistinguri'] . ' @php;' . "\n"; - $path_options .= "\t\t" . '}' . "\n"; // remove already used entries so we do not have doubles unset($htpasswds[$idx]); } @@ -987,7 +984,7 @@ class Nginx extends HttpConfigBase $this->vhost_root_autoindex = false; } else { - $path_options .= "\t" . 'location ' . $path . ' {' . "\n"; + $path_options .= "\t" . 'location ^~ ' . FileDir::makeCorrectFile($path) . ' {' . "\n"; if ($this->vhost_root_autoindex || $row['options_indexes'] != '0') { $path_options .= "\t\t" . 'autoindex on;' . "\n"; $this->vhost_root_autoindex = false; @@ -1029,7 +1026,11 @@ class Nginx extends HttpConfigBase unset($htpasswds[$idx]); break; default: - $path_options .= "\t" . 'location ' . FileDir::makeCorrectDir($single['path']) . ' {' . "\n"; + if ($single['path'] == '/') { + $path_options .= "\t" . 'location ' . FileDir::makeCorrectDir($single['path']) . ' {' . "\n"; + } else { + $path_options .= "\t" . 'location ^~ ' . FileDir::makeCorrectFile($single['path']) . ' {' . "\n"; + } $path_options .= "\t\t" . 'auth_basic "' . $single['authname'] . '";' . "\n"; $path_options .= "\t\t" . 'auth_basic_user_file ' . FileDir::makeCorrectFile($single['usrf']) . ';' . "\n"; if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') { @@ -1037,9 +1038,6 @@ class Nginx extends HttpConfigBase } else { $path_options .= "\t\t" . 'index index.html index.htm;' . "\n"; } - $path_options .= "\t\t" . 'location ~ ^(.+?\.php)(/.*)?$ {' . "\n"; - $path_options .= "\t\t\t" . 'try_files ' . $domain['nonexistinguri'] . ' @php;' . "\n"; - $path_options .= "\t\t" . '}' . "\n"; $path_options .= "\t" . '}' . "\n"; } // } @@ -1053,14 +1051,17 @@ class Nginx extends HttpConfigBase protected function getHtpasswds($domain) { $result_stmt = Database::prepare(" - SELECT * + SELECT a.* FROM `" . TABLE_PANEL_HTPASSWDS . "` AS a JOIN `" . TABLE_PANEL_DOMAINS . "` AS b USING (`customerid`) + LEFT JOIN `" . TABLE_PANEL_CUSTOMERS . "` c ON c.customerid = b.customerid WHERE b.customerid = :customerid AND b.domain = :domain + AND (a.path = CONCAT(c.documentroot, :ttool, '/') OR INSTR(a.path, b.documentroot)); "); Database::pexecute($result_stmt, [ 'customerid' => $domain['customerid'], - 'domain' => $domain['domain'] + 'domain' => $domain['domain'], + 'ttool' => Settings::Get('system.traffictool') ]); $returnval = []; @@ -1144,11 +1145,14 @@ class Nginx extends HttpConfigBase { $phpopts = ''; if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') { - $phpopts = "\tlocation ~ \.php {\n"; - $phpopts .= "\t\t" . 'try_files ' . $domain['nonexistinguri'] . ' @php;' . "\n"; - $phpopts .= "\t" . '}' . "\n\n"; + $phpopts = "\t" . 'location ~ ^(.+?\.php)(/.*)?$ {' . "\n"; + if ($domain['notryfiles'] != 1) { + $phpopts .= "\t\t" . 'try_files ' . $domain['nonexistinguri'] . ' @php;' . "\n"; + $phpopts .= "\t" . '}' . "\n\n"; - $phpopts .= "\tlocation @php {\n"; + $phpopts .= "\tlocation @php {\n"; + $phpopts .= "\t\t" . 'try_files $1 =404;' . "\n\n"; + } $phpopts .= "\t\tfastcgi_split_path_info ^(.+?\.php)(/.*)$;\n"; $phpopts .= "\t\tinclude " . Settings::Get('nginx.fastcgiparams') . ";\n"; $phpopts .= "\t\tfastcgi_param SCRIPT_FILENAME \$request_filename;\n"; diff --git a/lib/Froxlor/Cron/Http/NginxFcgi.php b/lib/Froxlor/Cron/Http/NginxFcgi.php index e655b0fa..33a6928d 100644 --- a/lib/Froxlor/Cron/Http/NginxFcgi.php +++ b/lib/Froxlor/Cron/Http/NginxFcgi.php @@ -100,11 +100,13 @@ class NginxFcgi extends Nginx $phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']); $php_options_text = "\t" . 'location ~ ^(.+?\.php)(/.*)?$ {' . "\n"; - $php_options_text .= "\t\t" . 'try_files ' . $domain['nonexistinguri'] . ' @php;' . "\n"; - $php_options_text .= "\t" . '}' . "\n\n"; + if ($domain['notryfiles'] != 1) { + $php_options_text .= "\t\t" . 'try_files ' . $domain['nonexistinguri'] . ' @php;' . "\n"; + $php_options_text .= "\t" . '}' . "\n\n"; - $php_options_text .= "\t" . 'location @php {' . "\n"; - $php_options_text .= "\t\t" . 'try_files $1 =404;' . "\n\n"; + $php_options_text .= "\t" . 'location @php {' . "\n"; + $php_options_text .= "\t\t" . 'try_files $1 =404;' . "\n\n"; + } $php_options_text .= "\t\t" . 'include ' . Settings::Get('nginx.fastcgiparams') . ";\n"; $php_options_text .= "\t\t" . 'fastcgi_split_path_info ^(.+?\.php)(/.*)$;' . "\n"; $php_options_text .= "\t\t" . 'fastcgi_param SCRIPT_FILENAME $request_filename;' . "\n"; diff --git a/lng/de.lng.php b/lng/de.lng.php index 3443ef1e..f28f7dcb 100644 --- a/lng/de.lng.php +++ b/lng/de.lng.php @@ -2043,7 +2043,7 @@ Vielen Dank, Ihr Administrator', 'traffictool' => [ 'toolselect' => 'Traffic Analyzer', ], - 'requires_reconfiguration' => 'Änderungen an dieser Einstellungen benötigen unter Umständen eine erneute Konfiguration der folgenden Dienste: %s', + 'requires_reconfiguration' => 'Änderungen an dieser Einstellungen benötigen unter Umständen eine erneute Konfiguration der folgenden Dienste:
%s', ], 'spf' => [ 'use_spf' => 'Aktiviere SPF für Domains?', diff --git a/lng/en.lng.php b/lng/en.lng.php index be9658d3..8135b98c 100644 --- a/lng/en.lng.php +++ b/lng/en.lng.php @@ -2165,7 +2165,7 @@ Yours sincerely, your administrator', 'awstats' => 'AWStats', 'goaccess' => 'goacccess' ], - 'requires_reconfiguration' => 'Changing this settings might require a reconfiguration of the following services: %s', + 'requires_reconfiguration' => 'Changing this settings might require a reconfiguration of the following services:
%s', ], 'spf' => [ 'use_spf' => 'Activate SPF for domains?',