NGINX屏蔽ip,https(443端口)有效,而http(80端口)无效

自己设置的ipblock.conf文件,deny了自己的手机ip然后includeipblock.conf;到服务器的nginx.conf的http{}下面效果:
网站1是https协议,ip屏蔽成功
网站2是http协议,ip屏蔽无效
然后将在http网站的conf文件里面添加了includeipblock.conf;依然无效然后将denyip;直接写到http协议网站的conf文件里面,还是无法屏蔽
请教各位上仙,这个怎么解决
相关配置:文件夹/conf/下面文件:ipblock.conf
denyip;
…………
文件:nginx.conf
http
{
includemime.types;
default_typeapplication/octet-stream;
includeipblock.conf;
…………
文件夹/conf/vhost下面网站1(https协议).conf
server
{
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协议).conf
server
{
listen80;
#listen[::]:80;
server_namewww.name2.comname2.com;
indexindex.htmlindex.htmindex.phpdefault.htmldefault.htmdefault.php;
root/home/wwwroot/www.name2.com;
//这儿添加的includeipblock.conf;
//或者直接写的denyip;
江户川乱折腾
浏览 3020回答 2
2回答

BIG阳

可能的原因:你的手机流量被运营商做了缓存你的手机的浏览器开启了类似的“省流量”的功能,比如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

看起来配置没有问题。若是在ipblock.conf文件中使用了静态IP,例如deny1.2.3.4;allowall;那很可能是你的手机浏览器访问http时使用了某些加速服务,它透过第三方服务IP去访问你的网站。但由于https是加密连接,无法加速,因此使用的是你的手机IP。你可以通过查询nginx访问日志,或在服务器抓包来确认。
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript