nginx 为dd目录下的sxphp这个链接删除Referer信息
要删除nginx中指定目录下的链接的Referer信息,可以使用以下配置:
-
打开nginx配置文件,通常为
/etc/nginx/nginx.conf。 -
在
http块中添加以下配置:map $http_referer $remove_referer { default ""; ~^https?://domain\.com/dd/sx\.php(.*) ""; }这里的
https?://domain\.com/dd/sx\.php是要删除Referer信息的链接的正则表达式,可以根据实际情况进行修改。 -
在具体的
server块或location块中添加以下配置:location /dd/sx.php { proxy_set_header Referer $remove_referer; # 其他配置... }这里的
/dd/sx.php是要删除Referer信息的链接的路径,可以根据实际情况进行修改。 -
保存配置文件并重启nginx服务。
sudo service nginx restart
现在,当访问/dd/sx.php链接时,nginx会删除Referer信息
原文地址: https://www.cveoy.top/t/topic/iVMO 著作权归作者所有。请勿转载和采集!