Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
nginx multistore magento_Magento_Nginx - Fatal编程技术网

nginx multistore magento

nginx multistore magento,magento,nginx,Magento,Nginx,我正在寻找一种在Magento上的多商店环境中设置Nginx的方法。我已经安装了服务器+Nginx,添加了域,一切都很好 不幸的是,通常在.htaccess中进行的调整不起作用。我不确定在哪里添加这个(index.php?)。所以我的问题是:如何使用multiurl设置multistore (是的:我试过Magento手册,但它没有提到multistore)您可以将切换逻辑添加到index.php,但该文件的设计目的是在生产环境中保持不变。您需要传入环境变量以触发加载正确的存储配置($\u SE

我正在寻找一种在Magento上的多商店环境中设置Nginx的方法。我已经安装了服务器+Nginx,添加了域,一切都很好

不幸的是,通常在.htaccess中进行的调整不起作用。我不确定在哪里添加这个(index.php?)。所以我的问题是:如何使用multiurl设置multistore

(是的:我试过Magento手册,但它没有提到multistore)

您可以将切换逻辑添加到index.php,但该文件的设计目的是在生产环境中保持不变。您需要传入环境变量以触发加载正确的存储配置(
$\u SERVER['MAGE\u RUN\u code']

在Apache配置中,这是使用
mod_env
SetEnv
/
setenif
完成的。您需要在nginx中执行类似操作,并根据您的需要执行。对于nginx,
SetEnv
的类似方法是
fastcgi_param


如果您的意思是设置每个门店的门店代码,则可以使用HTTPMapModule

例如,对于每个存储的域:

map $http_host $storecode {
    domain.com store1code;
}
...

fastcgi_param MAGE_RUN_CODE $storecode;

*向本马克挥手。

检查帖子的答案


这用一个例子来解释

如果您在共享托管环境中,请确保为$storecode使用唯一命名的变量。Nginx似乎在全局上下文中创建这些变量,因此将其称为storecodeNginx不支持htaccess文件,因此您需要在vhost的conf文件中完成所有操作(或者Nginx称之为
server