2

I am developing multi stores based on multi domains, I have strictly followed the tutorial online:

http://devdocs.magento.com/guides/v2.0/config-guide/multi-site/ms_websites.html; http://devdocs.magento.com/guides/v2.0/config-guide/multi-site/ms_apache.html.

I have created three websites, three stores, and three store views, finished configuration about url at admin; And then added the following to httpd.conf:

<VirtualHost 104.245.74.42:80>
  ServerName domain2.com
  ServerAlias mail.domain2.com www.domain2.com
  DocumentRoot /home/domain1/public_html
  SetEnv MAGE_RUN_CODE "domain2"
  SetEnv MAGE_RUN_TYPE "website"

  ServerAdmin webmaster@domain1.com
  UseCanonicalName Off
  CustomLog /etc/apache2/logs/domlogs/domain2.com combined
  <IfModule log_config_module>
    <IfModule logio_module>
      CustomLog /etc/apache2/logs/domlogs/domain2.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    </IfModule>
  </IfModule>
  <IfModule include_module>
    <Directory "/home/domain1/public_html">
      SSILegacyExprParser On
    </Directory>
  </IfModule>
  <IfModule alias_module>
    ScriptAlias /cgi-bin/ /home/domain1/public_html/cgi-bin/
  </IfModule>
</VirtualHost>

And the following to index.php

switch($_SERVER['HTTP_HOST']) {
    case 'domain1.com':
        $mageRunCode = 'base';
        $mageRunType = 'website';
    break;
    case 'domain2.com':
        $mageRunCode = 'domain2';
        $mageRunType = 'website';
    break;
}
$params = $_SERVER;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = $mageRunCode;
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = $mageRunType;
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);

Basically domain1 is our primary domain, domain2 is the second domain. My boss also installed the cPanel to the domain2, and asked me to copy and paste the same index.php and .htaccess files from domain1 to domain2 root. And then use symbolic links under domain2 root directory to create links pointed to the app, web, var and pub folders from domain1.

But now the domain2.com shows 500, I have checked the error_log under root of domain2, and it says

[06-Dec-2017 17:53:08 UTC] PHP Warning: require(/home/domain2/public_html/app/bootstrap.php): failed to open stream: No such file or directory in /home/domain2/public_html/index.php on line 22

[06-Dec-2017 17:53:08 UTC] PHP Fatal error: require(): Failed opening required '/home/domain2/public_html/app/bootstrap.php' (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/domain2/public_html/index.php on line 22

, which seems that the symbolic links do not work. Can anyone help me with it? Should we install the cPanel on domain2 (since it is not in the document)?

Thanks for any advises!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.