I have magento instance running on 8090 port. I have created an another store call store2 I followed all the steps and also change base url and added store code with base url as per this link
My virtual host file is below.
<VirtualHost *:80>
ServerName http://192.168.1.179:8090/
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName http://192.168.1.179:8090/store2/
DocumentRoot /var/www/html/
SetEnv MAGE_RUN_CODE "store2"
SetEnv MAGE_RUN_TYPE "website"
</VirtualHost>
My index.php is below.
<?php
try {
require __DIR__ . '/app/bootstrap.php';
} catch (\Exception $e) {
echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<div style="margin:0 0 25px 0; border-bottom:1px solid #ccc;">
<h3 style="margin:0;font-size:1.7em;font-weight:normal;text-transform:none;text-align:left;color:#2f2f2f;">
Autoload error</h3>
</div>
<p>{$e->getMessage()}</p>
</div>
HTML;
exit(1);
}
$params = $_SERVER;
$customstore = array(
'http://192.168.1.179:8090/store2'=>'store2' // Website, Store or Storeview Code
);
if(isset($customstore[$_SERVER['HTTP_HOST']]))
$websitecode = $customstore[$_SERVER['HTTP_HOST']];
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = isset($websitecode) ? $websitecode : '';
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';//use website or store or view
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);
but my http://192.168.1.179:8090/store2 returns 404 error.