Nginx的 - Magento的多个网站 [英] Nginx - Magento multiple websites

查看:241
本文介绍了Nginx的 - Magento的多个网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有个Magento的安装与多个网站,这是在Apache Web服务器上运行。 现在我想将这些以Nginx的网络服务器;我怎么能做到这一点与Nginx的配置? 下面是htaccess的code被重定向网站:

I have a Magento installation with multiple websites, which is running in Apache web server. Now I want to move these to Nginx web server; how can I achieve this with Nginx configuration? Below is the htaccess code which is redirecting websites:

SetEnvIf HOST 44\.55\.222\.101\:8080 MAGE_RUN_CODE=website_new
SetEnvIf HOST 44\.55\.222\.101\:8080 MAGE_RUN_TYPE=website

请帮忙。

推荐答案

要运行在同一台服务器与您bave使用2个不同的nginx的配置文件,为每个端口不同的端口下的 /等上2 Magento的网站/nginx/conf.d /

To run 2 Magento websites on the same server with different ports you bave to use 2 different nginx configuration files for each port under /etc/nginx/conf.d/.

从这个例子,只要它好像你正在运行的端口80和8080的网站Magento的曾在<一提供的默认nginx的配置在这里href="http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/configuring_nginx_for_magento" rel="nofollow">http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/configuring_nginx_for_magento

From the example provided it seems like you are running the websites on ports 80 and 8080. The Magento has provided the default nginx configuration here at http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/configuring_nginx_for_magento

使用此端口80和8080使用低于code:

Use this for port 80 and for 8080 use the below code:

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; 
    }
}

这篇关于Nginx的 - Magento的多个网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆