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.

1

1 Answer 1

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);
3
  • 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
    Commented Jul 25, 2022 at 12:36
  • are you using single magento for multiple websites right ? Commented Jul 26, 2022 at 6: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
    Commented Jul 26, 2022 at 7:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.