要为sx.php链接添加请求头的Referer,你需要在Nginx配置文件中使用proxy_set_header指令。

首先,找到Nginx配置文件,通常是/etc/nginx/nginx.conf/etc/nginx/sites-available/default

然后,在相应的location块中,添加以下配置行:

location /sx.php {
    proxy_set_header Referer "http://example.com";
    proxy_pass http://backend;
}

http://example.com替换为你想要设置的Referer值。如果你想使用当前请求的Referer作为值,可以使用$http_referer变量:

location /sx.php {
    proxy_set_header Referer $http_referer;
    proxy_pass http://backend;
}

保存配置文件并重新加载Nginx,使配置生效:

sudo systemctl reload nginx

现在,当访问sx.php链接时,Nginx会自动在请求头中包含Referer

nginx 为sxphp这个链接添加请求头的Referer

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

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