自己设置的ipblock.conf文件,deny了自己的手机ip
然后include ipblock.conf;
到服务器的nginx.conf的http{}
下面
效果:
- 网站1是https协议,ip屏蔽成功
- 网站2是http协议,ip屏蔽无效
然后将在http网站的conf文件里面添加了include ipblock.conf;
依然无效
然后将deny ip;
直接写到http协议网站的conf文件里面,还是无法屏蔽
请教各位上仙,这个怎么解决
相关配置:
文件夹/conf/下面
文件:ipblock.conf
deny ip;
…………
文件:nginx.conf
http
{
include mime.types;
default_type application/octet-stream;
include ipblock.conf;
…………
文件夹/conf/vhost下面
网站1(https协议).conf
server
{
listen 80;
#listen [::]:80;
server_name www.name1.com name1.com *.name1.com;
return 301 https://www.nam1e.com$request_uri;
}
server
{
listen 443 ssl http2;
#listen [::]:443 ssl http2;
server_name www.name1.com name1.com *.name1.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.name1.com;
ssl on;
…………
网站2(http协议).conf
server
{
listen 80;
#listen [::]:80;
server_name www.name2.com name2.com;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.name2.com;
//这儿添加的include ipblock.conf;
//或者直接写的deny ip;
可能的原因:
简而言之,尽量不要用手机来做这种涉及到IP的测试,除非你确定中间经过什么
可以增加两项配置来做测试: