add domain flag to avoid generation of nginx try_files directive in webroot which is not suitable for some applications; fixes #461
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -429,6 +429,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
}
|
||||
|
||||
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
|
||||
$notryfiles = isset($_POST['notryfiles']) && (int)$_POST['notryfiles'] == 1 ? 1 : 0;
|
||||
validate($_POST['documentroot'], 'documentroot');
|
||||
|
||||
// If path is empty and 'Use domain name as default value for DocumentRoot path' is enabled in settings,
|
||||
@@ -451,6 +452,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
$zonefile = '';
|
||||
$dkim = '1';
|
||||
$specialsettings = '';
|
||||
$notryfiles = '0';
|
||||
}
|
||||
|
||||
if ($userinfo['caneditphpsettings'] == '1' || $userinfo['change_serversettings'] == '1') {
|
||||
@@ -801,6 +803,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
'mod_fcgid_starter' => $mod_fcgid_starter,
|
||||
'mod_fcgid_maxrequests' => $mod_fcgid_maxrequests,
|
||||
'specialsettings' => $specialsettings,
|
||||
'notryfiles' => $notryfiles,
|
||||
'registration_date' => $registration_date,
|
||||
'termination_date' => $termination_date,
|
||||
'issubof' => $issubof,
|
||||
@@ -850,6 +853,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
'openbasedir' => $openbasedir,
|
||||
'speciallogfile' => $speciallogfile,
|
||||
'specialsettings' => $specialsettings,
|
||||
'notryfiles' => $notryfiles,
|
||||
'ssl_redirect' => $ssl_redirect,
|
||||
'add_date' => time(),
|
||||
'registration_date' => $registration_date,
|
||||
@@ -889,6 +893,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
`openbasedir` = :openbasedir,
|
||||
`speciallogfile` = :speciallogfile,
|
||||
`specialsettings` = :specialsettings,
|
||||
`notryfiles` = :notryfiles,
|
||||
`ssl_redirect` = :ssl_redirect,
|
||||
`add_date` = :add_date,
|
||||
`registration_date` = :registration_date,
|
||||
@@ -1338,6 +1343,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
|
||||
$specialsettings = validate(str_replace("\r\n", "\n", $_POST['specialsettings']), 'specialsettings', '/^[^\0]*$/');
|
||||
$ssfs = (isset($_POST['specialsettingsforsubdomains']) && intval($_POST['specialsettingsforsubdomains']) == 1) ? 1 : 0;
|
||||
$notryfiles = isset($_POST['notryfiles']) && (int)$_POST['notryfiles'] == 1 ? 1 : 0;
|
||||
$documentroot = validate($_POST['documentroot'], 'documentroot');
|
||||
|
||||
if ($documentroot == '') {
|
||||
@@ -1359,6 +1365,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
$dkim = $result['dkim'];
|
||||
$specialsettings = $result['specialsettings'];
|
||||
$ssfs = (empty($specialsettings) ? 0 : 1);
|
||||
$notryfiles = $result['notryfiles'];
|
||||
$documentroot = $result['documentroot'];
|
||||
}
|
||||
|
||||
@@ -1655,6 +1662,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
'mod_fcgid_maxrequests' => $mod_fcgid_maxrequests,
|
||||
'specialsettings' => $specialsettings,
|
||||
'specialsettingsforsubdomains' => $ssfs,
|
||||
'notryfiles' => $notryfiles,
|
||||
'registration_date' => $registration_date,
|
||||
'termination_date' => $termination_date,
|
||||
'issubof' => $issubof,
|
||||
@@ -1697,6 +1705,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
$mod_fcgid_starter != $result['mod_fcgid_starter'] ||
|
||||
$mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] ||
|
||||
$specialsettings != $result['specialsettings'] ||
|
||||
$notryfiles != $result['notryfiles'] ||
|
||||
$aliasdomain != $result['aliasdomain'] ||
|
||||
$issubof != $result['ismainbutsubto'] ||
|
||||
$email_only != $result['email_only'] ||
|
||||
@@ -1855,6 +1864,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
$update_data['mod_fcgid_starter'] = $mod_fcgid_starter;
|
||||
$update_data['mod_fcgid_maxrequests'] = $mod_fcgid_maxrequests;
|
||||
$update_data['specialsettings'] = $specialsettings;
|
||||
$update_data['notryfiles'] = $notryfiles;
|
||||
$update_data['registration_date'] = $registration_date;
|
||||
$update_data['termination_date'] = $termination_date;
|
||||
$update_data['ismainbutsubto'] = $issubof;
|
||||
@@ -1889,6 +1899,7 @@ if ($page == 'domains' || $page == 'overview') {
|
||||
`mod_fcgid_starter` = :mod_fcgid_starter,
|
||||
`mod_fcgid_maxrequests` = :mod_fcgid_maxrequests,
|
||||
`specialsettings` = :specialsettings,
|
||||
`notryfiles` = :notryfiles,
|
||||
`registration_date` = :registration_date,
|
||||
`termination_date` = :termination_date,
|
||||
`ismainbutsubto` = :ismainbutsubto,
|
||||
|
||||
@@ -260,6 +260,7 @@ CREATE TABLE `panel_domains` (
|
||||
`hsts_preload` tinyint(1) NOT NULL default '0',
|
||||
`ocsp_stapling` tinyint(1) DEFAULT '0',
|
||||
`http2` tinyint(1) DEFAULT '0',
|
||||
`notryfiles` tinyint(1) DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `customerid` (`customerid`),
|
||||
KEY `parentdomain` (`parentdomainid`),
|
||||
@@ -687,7 +688,7 @@ opcache.interned_strings_buffer'),
|
||||
('panel', 'password_special_char', '!?<>§$%+#=@'),
|
||||
('panel', 'customer_hide_options', ''),
|
||||
('panel', 'version', '0.9.39.2'),
|
||||
('panel', 'db_version', '201802120');
|
||||
('panel', 'db_version', '201802130');
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `panel_tasks`;
|
||||
|
||||
@@ -3912,3 +3912,12 @@ if (isDatabaseVersion('201801260')) {
|
||||
|
||||
updateToDbVersion('201802120');
|
||||
}
|
||||
|
||||
if (isDatabaseVersion('201802120')) {
|
||||
|
||||
showUpdateStep("Adding domain field for try_files flag");
|
||||
Database::query("ALTER TABLE `" . TABLE_PANEL_DOMAINS . "` ADD `notryfiles` tinyint(1) DEFAULT '0';");
|
||||
lastStepStatus(0);
|
||||
|
||||
updateToDbVersion('201802130');
|
||||
}
|
||||
|
||||
@@ -131,6 +131,19 @@ return array(
|
||||
'type' => 'textarea',
|
||||
'cols' => 60,
|
||||
'rows' => 12
|
||||
),
|
||||
'notryfiles' => array(
|
||||
'visible' => (Settings('system.webserver') == 'nginx' && $userinfo['change_serversettings'] == '1'),
|
||||
'label' => $lng['admin']['notryfiles']['title'],
|
||||
'desc' => $lng['admin']['notryfiles']['description'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array()
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
@@ -161,6 +161,21 @@ return array(
|
||||
'value' => array(
|
||||
'1'
|
||||
)
|
||||
),
|
||||
'notryfiles' => array(
|
||||
'visible' => (Settings('system.webserver') == 'nginx' && $userinfo['change_serversettings'] == '1'),
|
||||
'label' => $lng['admin']['notryfiles']['title'],
|
||||
'desc' => $lng['admin']['notryfiles']['description'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array(
|
||||
$result['notryfiles']
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
$version = '0.9.39.2';
|
||||
|
||||
// Database version (YYYYMMDDC where C is a daily counter)
|
||||
$dbversion = '201802120';
|
||||
$dbversion = '201802130';
|
||||
|
||||
// Distribution branding-tag (used for Debian etc.)
|
||||
$branding = '';
|
||||
|
||||
@@ -2115,3 +2115,5 @@ $lng['admin']['plans']['add'] = 'Add new plan';
|
||||
$lng['admin']['plans']['edit'] = 'Edit plan';
|
||||
$lng['admin']['plans']['use_plan'] = 'Apply plan';
|
||||
$lng['question']['plan_reallydelete'] = 'Do you really want to delete the hosting plan %s?';
|
||||
$lng['admin']['notryfiles']['title'] = 'No autogenerated try_files';
|
||||
$lng['admin']['notryfiles']['description'] = 'Say yes here if you want to specify a custom try_files directive in specialsettings (needed for some wordpress plugins for example).';
|
||||
|
||||
@@ -1765,3 +1765,5 @@ $lng['admin']['plans']['add'] = 'Neuen Plan anlegen';
|
||||
$lng['admin']['plans']['edit'] = 'Plan editieren';
|
||||
$lng['admin']['plans']['use_plan'] = 'Plan übernehmen';
|
||||
$lng['question']['plan_reallydelete'] = 'Wollen Sie den Hosting-Plan "%s" wirklich löschen?';
|
||||
$lng['admin']['notryfiles']['title'] = 'Keine generierte try_files Anweisung';
|
||||
$lng['admin']['notryfiles']['description'] = 'Wähle "Ja", wenn eine eigene try_files Direktive in den "eigenen Vhost Einstellungen" angegeben werden soll (z.B. nötig für manche Wordpress Plugins).';
|
||||
|
||||
@@ -916,7 +916,9 @@ class nginx extends HttpConfigBase
|
||||
|
||||
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') {
|
||||
$webroot_text .= "\t" . 'index index.php index.html index.htm;' . "\n";
|
||||
if ($domain['notryfiles'] != 1) {
|
||||
$webroot_text .= "\t\t" . 'try_files $uri $uri/ @rewrites;' . "\n";
|
||||
}
|
||||
} else {
|
||||
$webroot_text .= "\t" . 'index index.html index.htm;' . "\n";
|
||||
}
|
||||
@@ -927,7 +929,7 @@ class nginx extends HttpConfigBase
|
||||
}
|
||||
|
||||
$webroot_text .= "\t" . '}' . "\n\n";
|
||||
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1') {
|
||||
if ($domain['phpenabled_customer'] == 1 && $domain['phpenabled_vhost'] == '1' && $domain['notryfiles'] != 1) {
|
||||
$webroot_text .= "\tlocation @rewrites {\n";
|
||||
$webroot_text .= "\t\trewrite ^ /index.php last;\n";
|
||||
$webroot_text .= "\t}\n\n";
|
||||
|
||||
Reference in New Issue
Block a user