Skip to content

Commit ea9eb2b

Browse files
MAGETWO-46636: Nginx doesn't redirect to setup page when using port
1 parent ada45cc commit ea9eb2b

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

lib/internal/Magento/Framework/App/Http.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ private function redirectToSetup(Bootstrap $bootstrap, \Exception $exception)
241241
. "because the Magento setup directory cannot be accessed. \n"
242242
. 'You can install Magento using either the command line or you must restore access '
243243
. 'to the following directory: ' . $setupInfo->getDir($projectRoot) . "\n";
244-
$newMessage .= 'If you are using the sample nginx configuration, please go to '
245-
. $this->_request->getScheme(). '://' . $this->_request->getHttpHost() . $setupInfo->getUrl();
244+
246245
throw new \Exception($newMessage, 0, $exception);
247246
}
248247
}

lib/internal/Magento/Framework/App/SetupInfo.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ public function isAvailable()
147147
{
148148
$setupDir = $this->getDir($this->projectRoot);
149149
$isSubDir = false !== strpos($setupDir . '/', $this->docRoot . '/');
150+
// Setup is not accessible from pub folder MAGETWO-52799
151+
$setupDir = str_replace('/pub/', '/', $setupDir);
152+
150153
return $isSubDir && realpath($setupDir);
151154
}
152155

lib/internal/Magento/Framework/App/Test/Unit/SetupInfoTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ public function isAvailableDataProvider()
193193
],
194194
true
195195
],
196+
'root within doc root + pub, existent sub-directory' => [
197+
[
198+
'DOCUMENT_ROOT' => __DIR__ . '/_files/pub/',
199+
'SCRIPT_FILENAME' => __DIR__ . '/_files/pub/index.php',
200+
],
201+
true
202+
],
196203
];
197204
}
198205
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/

0 commit comments

Comments
 (0)