每种语言的位置不同

每种语言的位置不同

我们的服务器设置如下:

/var
    /www
        /website
            /language1
                /public
            /language2
                /public
            /language3
                /public
            /language4
                /public

因此,我尝试设置正确的 nginx 配置,并将位置传递到不同的文件夹。我试过这个:

location /language1 {
    alias /var/www/website/language1/public;

    index index.php;
    try_files $uri $uri/ /index.php?sef_rewrite=1&$args;

    location = /language1/favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /language1/robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

    location ~ \.(png|gif|ico|swf|jpe?g|js|css|ttf|svg|eot|woff)$ {
        if (!-e $request_filename){
            rewrite ^/(.*?)\/(.*)$ /$2 last;
        }
    }

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;

        fastcgi_index index.php;
        fastcgi_pass unix:/var/run/php-fpm/php.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        fastcgi_keep_conn on;
        fastcgi_intercept_errors on;

        fastcgi_temp_file_write_size 10m;
        fastcgi_busy_buffers_size    512k;
        fastcgi_buffer_size          512k;
        fastcgi_buffers           16 512k;
        fastcgi_read_timeout         1200;
    }
}

只是现在无论我怎么尝试,我都会不断收到 404 或文件未找到错误。我将别名更改为 root,PHP 位置是否位于 /language1 位置之外,等等。有谁能给我指明正确的方向?

相关内容