如何拒绝除Nginx中的一个以外的所有URI?

问题描述 投票:0回答:1

我有一个域,我只需要接受一个网址,所有其他网址都应被阻止。我只需要接受/page?param=something。我正在使用Nginx。任何帮助,将不胜感激。

regex nginx pcre nginx-location nginx-config
1个回答
0
投票
map $query_string $is_param {
    ~ param=.+ 1;
}

location ~* /page {
    if ($is_param) {
      allow all;
    }
    return 403;
}
© www.soinside.com 2019 - 2024. All rights reserved.