要删除nginx中指定目录下的链接的Referer信息,可以使用以下配置:

  1. 打开nginx配置文件,通常为/etc/nginx/nginx.conf

  2. http块中添加以下配置:

    map $http_referer $remove_referer {
        default "";
        ~^https?://domain\.com/dd/sx\.php(.*) "";
    }
    

    这里的https?://domain\.com/dd/sx\.php是要删除Referer信息的链接的正则表达式,可以根据实际情况进行修改。

  3. 在具体的server块或location块中添加以下配置:

    location /dd/sx.php {
        proxy_set_header Referer $remove_referer;
        # 其他配置...
    }
    

    这里的/dd/sx.php是要删除Referer信息的链接的路径,可以根据实际情况进行修改。

  4. 保存配置文件并重启nginx服务。

    sudo service nginx restart
    

现在,当访问/dd/sx.php链接时,nginx会删除Referer信息

nginx 为dd目录下的sxphp这个链接删除Referer信息

原文地址: https://www.cveoy.top/t/topic/iVMO 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录