Please help, can't seem to figure this one out.
Magento 2.1.3 is setup with 3 stores in the backend but on the Front End, the behavior is as follows :
- site1.com (set as default) is working fine when landing on the home page except that when looking up product catalog the url switches back to the EC2 public DNS
- When looking up site2.com, home page is working fine as well but the same behavior as site1.com happens and on top is goes back to site1.com product catalog.
etc/nginx/sites-available/magento looks like this :
upstream fastcgi_backend {
server unix:/run/php/php7.0-fpm.sock;
}
map $http_host $MAGE_RUN_CODE {
default '';
test.site1.com code1;
test.site2.com code2;
test.site3.com code3;
}
server {
listen 80;
server_name test.site1.com test.site2.com test.site3.com;
set $MAGE_ROOT /var/www/html/Magento;
set $MAGE_MODE developer; # or production
access_log /var/log/nginx/Magento-access.log;
error_log /var/log/nginx/Magento-error.log;
include /var/www/html/Magento/nginx.conf.sample;
}
nginx.conf.sample section as follows:
# PHP entry point for main application
location ~ (index|get|static|report|404|503)\.php$ {
try_files $uri =404;
fastcgi_pass fastcgi_backend;
fastcgi_buffers 1024 4k;
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;
fastcgi_param MAGE_RUN_TYPE website;
fastcgi_param MAGE_RUN_CODE $MAGE_RUN_CODE;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}