cancel
Showing results for 
Search instead for 
Did you mean: 

multistore with magento 2 and nginx

multistore with magento 2 and nginx

Hello,
I am creating a multistore magento 2.4 and nginx. But I have a problem, I see the two shops with different url but in the secondary one, the hyperlinks and the content is from the main one. I don't know how I can solve it. You can see the error in https://www.productospeluqueria.es/ 

I explain step by step what I have done:

First test

In /etc/nginx/nginx.conf I put the following:

map $http_host $MAGE_RUN_CODE {
 productospeluqueria.es productospeluqueriaes;
 quafurg.com base;

}

In each domain I put the following:

server {

....

set $MAGE_MODE developer;
set $MAGE_RUN_TYPE website;
include /usr/share/nginx/html/magento/nginx.conf.sample;
}

In /usr/share/nginx/html/magento/nginx.conf.sample:

location ~ ^/(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {

...

fastcgi_param MAGE_RUN_TYPE website;
fastcgi_param MAGE_RUN_CODE $MAGE_RUN_CODE;
fastcgi_index index.php;
include fastcgi_params;

}

It did NOT work.

Now I have put Now I have put in each domain:

1 doman:

map $http_host $MAGE_RUN_CODE {
productospeluqueria.es productospeluqueriaes;
}
server {
server_name productospeluqueria.es www.productospeluqueria.es;
# Load configuration files for the default server block.
if ($host = productospeluqueria.es) {
return 301 https://www.$host$request_uri;
}
include /etc/nginx/default.d/*.conf;
set $MAGE_ROOT /usr/share/nginx/html/magento/;
set $MAGE_MODE developer;
set $MAGE_RUN_TYPE website;
include /usr/share/nginx/html/magento/nginx.conf.sample;

...

}

2 domain

map $http_host $MAGE_RUN_CODE {
quafurg.com base;
}
server {
server_name quafurg.com www.quafurg.com;
# Load configuration files for the default server block.
if ($host = quafurg.com) {
return 301 https://www.$host$request_uri;
}
include /etc/nginx/default.d/*.conf;
set $MAGE_ROOT /usr/share/nginx/html/magento/;
set $MAGE_MODE developer;
set $MAGE_RUN_TYPE website;
include /usr/share/nginx/html/magento/nginx.conf.sample;

It does not work either.
Can someone help me. Please.