nginx:リダイレクトが多すぎます

nginx:リダイレクトが多すぎます

リダイレクトを使用してnginx設定を作成する必要があります。ここに私のconfがあります。

server {

listen          8080;
server_name     test.example.org;
index           index.php index.html;
return          301 $scheme://test.example.org/dashboard;
location        /dashboard {
    alias           /path/to/files;
    index           index.php index.html;
    }
}

test.example.orgをtest.example.org/dashboardにリダイレクトする必要があり、test.example.orgに移動すると、ブラウザに「リダイレクトが多すぎます」というエラーが表示されます。

答え1

入れてみよう

return          301 $scheme://test.example.org/dashboard;

~へ

location / {
}

答え2

これが私がすることです

location / {

    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args @goto_dashboard;
}

location @goto_dashboard {
    return 301 http://xxx/dashboard;
}

関連情報