如何在 NGINX 上连接多个valid_referers

How to concatenate multiple valid_referers on NGINX

提问人:btgen 提问时间:7/7/2022 最后编辑:Ivan Shatskybtgen 更新时间:7/7/2022 访问量:117

问:

我正在尝试弄清楚如何连接多个valid_referers

location ~* \.(gif|otf|jpg|jpeg|png|css|js)$ {

    # need help with the line bellow to add multiple domains here
    valid_referers none blocked example.com *.example.com;

    if ($invalid_referer) {
        return   403;
    }

}

这会起作用吗?

location ~* \.(gif|otf|jpg|jpeg|png|css|js)$ {
    valid_referers none blocked ~\.notblock-one.com\.notblock-two.com ~\.notblock-three.com\. ~\.notblock-etc.com\.;
    if ($invalid_referer) { return 403; }   
}
nginx的

评论


答: 暂无答案