1

I'm trying to setup Multi website in AWS server. I found several solution for Multi website implementation.

In my case, There are two different servers(assume 0.0.0.1 and 0.0.0.2) where magento has installed on both the servers. I need to unlink the server configuration for 0.0.0.1 Magento and make 0.0.0.2 as default website and configure 0.0.0.1 as multi website in 0.0.0.2. I have done the multi website, store and storeview configuration in 0.0.0.2.

How do I update the server configuration for 0.0.0.1? Should I update its virtual host or /etc/nginx/nginx.conf or /etc/nginx/sites-available/magento or any other files to point to 0.0.0.2.

If this is resolved then I should be able to proceed with next steps in order to complete the multi website implementation.

We use nginx as web server. Using AWS server for development purpose.

TS Guhan
  • 369
  • 1
  • 14
  • I created multi website for AWS public ec2 domain and for its IP address. You can refer here. https://magento.stackexchange.com/questions/193679/magento-2-how-to-set-multi-websites-on-the-same-url/358597#358597 – TS Guhan Aug 05 '22 at 12:27

1 Answers1

1

you need to replace this code to magento index.php

 <?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); }

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); /** @var \Magento\Framework\App\Http $app */

$params = $_SERVER;

$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website_code'; //Webite code as same in admin panel

$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';

$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

/** @var \Magento\Framework\App\Http $app */

$app = $bootstrap->createApplication('Magento\Framework\App\Http');

$bootstrap->run($app);

Sanjay Shiyal
  • 968
  • 1
  • 10
  • 30
  • Want to know that how the main server receive the request from 0.0.0.1. And the solution which you provided to be added in 0.0.0.2 Magento right? – TS Guhan Jul 25 '22 at 12:36
  • are you using single magento for multiple websites right ? – Sanjay Shiyal Jul 26 '22 at 06:32
  • Yes like I said, each ip has installed with Magento. I want to use 2nd server as Main website and 1st ip for multi website. Also, want to know that how do I unlink Magento from 1st server and point to 2nd server. And use them(IP) for multi website. – TS Guhan Jul 26 '22 at 07:08