小编kar*_*ayi的帖子

Nginx - 将 Tor 出口节点 IP 列表重定向到特殊页面

我每 30 分钟下载一次 Tor 出口节点列表https://www.dan.me.uk/torlist/并将其保存到 tor-ip.conf 文件。

我的主机不允许为 nginx 安装任何模块,所以我必须使用我拥有的模块。

我想将文件包含到一个变量中,并在匹配时调用重定向。

配置文件

$bad_user {
    include /var/www/vhosts/domain/tor-ip.conf;
}

if ($bad_user) {
    rewrite ^ http://www.google.com;
}
Run Code Online (Sandbox Code Playgroud)

tor-ip.conf

1.41.177.72
1.42.47.215
100.0.53.178
100.15.114.155
100.16.220.246
100.34.251.120
100.36.123.111
100.6.14.127
100.7.25.216
101.100.144.174
101.175.68.120
101.176.45.79
...
Run Code Online (Sandbox Code Playgroud)

Nginx 不允许我直接使用变量作为$bad_user. 我怎么能设置呢?

nginx redirect tor

1
推荐指数
1
解决办法
1245
查看次数

标签 统计

nginx ×1

redirect ×1

tor ×1