Showing results for 
Search instead for 
Did you mean: 

URL issue on Ubuntu Nginx Multi Store setup on EC2

URL issue on Ubuntu Nginx Multi Store setup on EC2

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 :

- (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, home page is working fine as well but the same behavior as happens and on top is goes back to 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 ''; code1; code2; code3;

server {
    listen 80;
    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;