Sometime , we need to create multisite application using magento 2 framework.
Following example shows the nginix confgiration of multisite application with magento website or store
In this example contains three sites and each has different domain
upstream fastcgi_backend {
server unix:/run/php/php7.4-fpm.sock;
}
map $http_host $MAGE_RUN_CODE {
default '';
magento2lst.dev.bn.com ban;
magento2lst.dev.jk.com jak;
}
server {
listen 80;
server_name magento2lst.dev.com magento2lst.dev.bn.com magento2lst.dev.jk.com;
set $MAGE_ROOT /var/www/html/codepool;
set $MAGE_MODE developer ;
set $MAGE_RUN_TYPE website;
#set $MAGE_RUN_TYPE store;
include /var/www/html/codepool/nginx.conf.sample;
}
We need to add additional configuration in /var/www/html/codepool/nginx.conf.sample
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# START - Multisite customization
fastcgi_param MAGE_RUN_TYPE $MAGE_RUN_TYPE;
fastcgi_param MAGE_RUN_CODE $MAGE_RUN_CODE;
# END - Multisite customization
include fastcgi_params;
Magneto 2 configuration
Url configuration
Configure different domain url for each website created in magento 2 as follows
Posted by vasan to vasan's deck (2020-11-02 11:18)