Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thiagolima-bm/9504454b2c7ebc1d0798d31c5ec12282 to your computer and use it in GitHub Desktop.
Save thiagolima-bm/9504454b2c7ebc1d0798d31c5ec12282 to your computer and use it in GitHub Desktop.
Configure Multiple Magento2 Websites or Stores with Nginx
#etc/nginx/sites-available
map $http_host $MAGE_RUN_CODE {
mystore.com mystore_en;
mystore.de mystore_de;
mystore.es mystore_es;
}
server {
listen 80;
server_name mystore.com mystore.de mystore.es;
set $MAGE_ROOT /path/to/your/magento2;
set $MAGE_MODE default;
include /path/to/your/magento2/nginx.conf.sample;
}
#path/to/magento/nginx.conf.sample
#...
# 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_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
fastcgi_param PHP_VALUE "memory_limit=768M \n max_execution_time=600";
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;
#add here - start
fastcgi_param MAGE_RUN_TYPE store;
fastcgi_param MAGE_RUN_CODE $MAGE_RUN_CODE;
#end
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#...
@thiagolima-bm
Copy link
Author

@danitidia have you created multiple websites in Magento?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment