4

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

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

(是的:我试过 Magento 手册,但它没有说明多商店)

4

3 回答 3

7

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

http://wiki.nginx.org/HttpMapModule

例如对于每个商店的域:

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

fastcgi_param MAGE_RUN_CODE $storecode;

*在 Ben Marks 挥手致意。

于 2012-06-18T20:07:34.120 回答
1

You could add your switching logic to index.php, but that file is designed to remain unmodified for production environments. You need to pass environment variables in to trigger the loading of the correct store configuration ($_SERVER['MAGE_RUN_CODE']).

In Apache configs this is done using mod_env and SetEnv / SetEnvIf. You need to do the analogous in nginx, and do so according to your needs. For nginx the analogous method to SetEnv is fastcgi_param.

This seems relevant (3rd comment).

于 2012-06-18T11:26:05.840 回答
0

检查帖子 Nginx - Magento 多个网站的答案

这用一个例子来解释。

于 2012-09-04T05:16:20.440 回答