1

こんにちは私はmysite.comにmagentoストアを持っています

ここで、mysite.com/germanにあるドイツ語のWebサイトを実行するURLを設定します。

同じインストールを使用します。私はすでに半分機能している構成を持っていますが、私の問題は、ホームページを超えてすべてのmagentoURL404です。これが私の現在の構成です。

server {

    listen 80;

    server_name mysite.com www.mysite.com;

    ####
    #
    #  BELOW THIS LINE IS MY ATTEMPT TO GET mysite.com/german to run from the same directory as mysite.com
    #
    ####


    location ~ /german(.*)\.php($|/) {
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /usr/share/nginx/www$1.php;
        fastcgi_param MAGE_RUN_CODE german;
        fastcgi_param MAGE_RUN_TYPE website;        
    }

    location ~ /german(.*) {
        index index.htm index.php;
        autoindex off;
        alias /usr/share/nginx/www$1;
    }

    location ~ /deutch/ {
        index index.htm index.php;
        try_files $uri $uri/ @handler;
    }

古い設定:

    ###
    #
    # THIS BIT I THINK IS THE PART WHICH IS NOT QUITE WORKING, BUT I DON'T KNOW WHAT THE @handler PART DOES
    # 
    ###
    # This redirect is added so to use Magentos
    # common front handler when handling incoming URLs.
    location @handler {
        rewrite / /index.php;
    }

    ####
    #
    # BELOW THIS LINE IS THE ORIGINAL CONFIG WHICH RUNS mysite.com NO PROBLEMS
    #
    ####

    root /usr/share/nginx/www;

    location / {
        index index.htm index.php;
        try_files $uri $uri/ @handler;
    }

    # Deny access to specific directories no one
    # in particular needs access to anyways.
    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; }

    # Allow only those who have a login name and password
    # to view the export folder. Refer to /etc/nginx/htpassword.
    location /var/export/ {
        auth_basic "Restricted";
        auth_basic_user_file htpasswd;
        autoindex on;
    }

    # Deny all attempts to access hidden files
    # such as .htaccess, .htpasswd, etc...
    location ~ /\. {
         deny all;
         access_log off;
         log_not_found off;
    }

    # This redirect is added so to use Magentos
    # common front handler when handling incoming URLs.
    location @handler {
        rewrite / /index.php;
    }

    # Forward paths such as /js/index.php/x.js
    # to their relevant handler.
    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }

    # Handle the exectution of .php files.
    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 english;
        fastcgi_param MAGE_RUN_TYPE website;
        include fastcgi_params;
    }
}
4

1 に答える 1

2
location ~* \.php$ {
    if (!-e $request_filename) {
        rewrite / /index.php last;
    }
    expires off;
    set $runcode english;
    set $runtype website;
    if ( $request_uri ~* ^/german ) {
            set $runcode german;
    }
    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 $runcode;
    fastcgi_param MAGE_RUN_TYPE $runtype;
    include fastcgi_params;
}

つまり、パート1、パート2は、コードが同じコードベースから実行されるようにすることです。1つの解決策は、ディレクトリをルートディレクトリにシンボリックリンクし、/ usr / share / nginx/wwwディレクトリで次のコマンドを実行することです。

ln -s . ./german

それは汚いです、しかしそれは働きます;)

正しいインデックスファイルにリダイレクトするために、以下を使用しています。

location /german {
    if ( -e $request_filename ) {
        break;
    }
    rewrite ^/german(.*)$   /german/index.php last;
}
    #
    #       Redirection of subdirectory php's to their respective php files
    #       
    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }
    #
    #       Redirect everything else to root path
    #
    location / {
            try_files $uri $uri/ /index.php?$args;
    }
于 2013-01-04T11:45:34.703 に答える