Hi,
I use single Magento 2.2.6 codebase for multiple websites.
Everything worked just fine until today's software update in ubuntu 18.04.
Now, after update, all requests to other websites within my codebase, are being redirected to default store. So I can't open other stores.
Magento2, nginx and php7.1-fpm configs remained the same after the update and dpkg.log is too long to include here. But in dpkg.log I noticed that it updated php7.1-fpm from 7.1.20-1 to 7.1.22-1 itself and whole bunch of other modules related to it.
Does anyone know what might cause this malfunction, or where to look?
Thanks.
Hi @overjolted
I understand the problem you are facing.
But looking at the error - i mean the line you have posted that your PHP version is updated to 7.1.22 when you update ubuntu OS.
But i think that's not an issue - as i have seen the release notes and technology stack of magento 2.2.6 its supporting all the version of PHP - 7.1.X.
Possible solution is might be your url_rewrite mode of PHP is disabled , or might be use store code in URL that option is disabled.
Also as you have mention that there are multiple error is there - can you post at least few lines of error over here ? so its help us to trouble shoot the issue.
Hope it helps
Hey, thanks for your reply.
I don't know how to enable rewrites for in php7.1-fpm for nginx.
here's my sites-available-default from nginx:
--------------------- sites-available-default ---------------------
upstream fastcgi_backend {
server unix:/run/php/php7.1-fpm.sock;
}
map $HTTP_HOST $mage_run_code {
hostnames;
default base;
test1.local test1;
test2.local test2;
}
server {
listen 80;
server_name manage.local;
set $MAGE_ROOT /var/www/test1;
set $MAGE_RUN_TYPE website;
set $MAGE_RUN_CODE $mage_run_code;
include /var/www/test1/nginx.conf.sample;
}
server {
listen 80;
server_name test1.local;
set $MAGE_ROOT /var/www/test1;
set $MAGE_RUN_TYPE website;
set $MAGE_RUN_CODE $mage_run_code;
include /var/www/test1/nginx.conf.sample;
}
server {
listen 80;
server_name test2.local;
set $MAGE_ROOT /var/www/test1;
set $MAGE_RUN_TYPE website;
set $MAGE_RUN_CODE $mage_run_code;
include /var/www/test1/nginx.conf.sample;
}
--------------------- --------------------- ---------------------
here's my hosts file:
--------------------- /etc/hosts ---------------------
192.168.0.120 manage.local
192.168.0.120 test1.local
192.168.0.120 test2.local
--------------------- --------------------- ---------------------
here is my idnex.php
<?php
/**
* Application entry point
*
* Example - run a particular store or website:
* --------------------------------------------
* require __DIR__ . '/app/bootstrap.php';
* $params = $_SERVER;
* $params[\Magento\Store\Model\StoreManager:ARAM_RUN_CODE] = 'website2';
* $params[\Magento\Store\Model\StoreManager:ARAM_RUN_TYPE] = 'website';
* $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
* \/** @var \Magento\Framework\App\Http $app *\/
* $app = $bootstrap->createApplication(\Magento\Framework\App\Http::class);
* $bootstrap->run($app);
* --------------------------------------------
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
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;
$domain2store = array(
'manage.local'=>'base', // Replace your Website, Store or Storeview code with this.
'test1.local'=>'test1', // Replace your Website, Store or Storeview code with this.
'test2.local'=>'test2', // Replace your Website, Store or Storeview code with this.
);
if(isset($domain2store[$_SERVER['HTTP_HOST']]))
$storecode = $domain2store[$_SERVER['HTTP_HOST']];
$params[\Magento\Store\Model\StoreManager:ARAM_RUN_CODE] = isset($storecode) ? $storecode : '';
$params[\Magento\Store\Model\StoreManager:ARAM_RUN_TYPE] = 'store';
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $params);
$app = $bootstrap->createApplication('Magento\Framework\App\Http');
$bootstrap->run($app);