自己设置的ipblock.conf文件,deny了自己的手机ip然后includeipblock.conf;到服务器的nginx.conf的http{}下面效果:网站1是https协议,ip屏蔽成功网站2是http协议,ip屏蔽无效然后将在http网站的conf文件里面添加了includeipblock.conf;依然无效然后将denyip;直接写到http协议网站的conf文件里面,还是无法屏蔽请教各位上仙,这个怎么解决相关配置:文件夹/conf/下面文件:ipblock.confdenyip;…………文件:nginx.confhttp{includemime.types;default_typeapplication/octet-stream;includeipblock.conf;…………文件夹/conf/vhost下面网站1(https协议).confserver{listen80;#listen[::]:80;server_namewww.name1.comname1.com*.name1.com;return301https://www.nam1e.com$request_uri;}server{listen443sslhttp2;#listen[::]:443sslhttp2;server_namewww.name1.comname1.com*.name1.com;indexindex.htmlindex.htmindex.phpdefault.htmldefault.htmdefault.php;root/home/wwwroot/www.name1.com;sslon;…………网站2(http协议).confserver{listen80;#listen[::]:80;server_namewww.name2.comname2.com;indexindex.htmlindex.htmindex.phpdefault.htmldefault.htmdefault.php;root/home/wwwroot/www.name2.com;//这儿添加的includeipblock.conf;//或者直接写的denyip;
2 回答

BIG阳
TA贡献1859条经验 获得超6个赞
可能的原因:你的手机流量被运营商做了缓存你的手机的浏览器开启了类似的“省流量”的功能,比如Chrome和UC都有这种功能运营商对于不同协议,走的出口不一样简而言之,尽量不要用手机来做这种涉及到IP的测试,除非你确定中间经过什么可以增加两项配置来做测试:location=/ip{default_typetext/plain;allowall;return200"$remote_addr,$realip_remote_addr,$http_x_real_ip";}location=/deny{denyall;}然后用手机访问/ip,看下你服务器获取到的IP是多少;用手机访问/deny,看屏蔽是否有效。

宝慕林4294392
TA贡献2021条经验 获得超8个赞
看起来配置没有问题。若是在ipblock.conf文件中使用了静态IP,例如deny1.2.3.4;allowall;那很可能是你的手机浏览器访问http时使用了某些加速服务,它透过第三方服务IP去访问你的网站。但由于https是加密连接,无法加速,因此使用的是你的手机IP。你可以通过查询nginx访问日志,或在服务器抓包来确认。
添加回答
举报
0/150
提交
取消