我有一个包含多个网站的Magento安装,它在Apache Web服务器上运行。 现在我想将这些移动到Nginx Web服务器;如何通过Nginx配置实现这一目标? 以下是重定向网站的htaccess代码:
SetEnvIf HOST 44\.55\.222\.101\:8080 MAGE_RUN_CODE=website_new
SetEnvIf HOST 44\.55\.222\.101\:8080 MAGE_RUN_TYPE=website
请帮忙。
答案 0 :(得分:2)
要在具有不同端口的同一服务器上运行2个Magento网站,您需要为/etc/nginx/conf.d/
下的每个端口使用2个不同的nginx配置文件。
从提供的示例来看,您似乎在端口80和8080上运行网站.Magento在http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/configuring_nginx_for_magento
处提供了默认的nginx配置。将此用于端口80和8080使用以下代码:
server {
listen 8080 default;
server_name 44.55.222.101;
root /var/www/html;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ @handler;
expires 30d;
}
location ^~ /app/ { deny all; }
location ^~ /includes/ { deny all; }
location ^~ /lib/ { deny all; }
location ^~ /media/downloadable/ { deny all; }
location ^~ /pkginfo/ { deny all; }
location ^~ /report/config.xml { deny all; }
location ^~ /var/ { deny all; }
location /var/export/ {
auth_basic "Restricted";
auth_basic_user_file htpasswd;
autoindex on;
}
location /. {
return 404;
}
location @handler {
rewrite / /index.php;
}
location ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}
location ~ .php$ {
if (!-e $request_filename) { rewrite / /index.php last; }
expires off;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE website_new;
fastcgi_param MAGE_RUN_TYPE website;
include fastcgi_params;
}
}
答案 1 :(得分:2)
商店代码在管理>中定义配置>管理商店
fastcgi_param MAGE_RUN_CODE default;
fastcgi_param MAGE_RUN_TYPE store;
答案 2 :(得分:0)
.htaccess
和SetEnvIf
适用于Apache Web服务器。对于Nginx,您可以使用fastcgi_param
(如果您使用fastcgi运行nginx)。
您可以在此处找到更多详细信息: http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/configuring_nginx_for_magento