Home  >  Q&A  >  body text

html - How to deal with ngix being accessed by a large number of strange IPs on ubuntu? allow_host is fully enabled.

ubuntu@VM-14-106-ubuntu:/var/log/nginx$ tail -7 access.log.1
107.150.2.60 - - [23/Apr/2017:03:01:04 +0800 ] "GET / HTTP/1.1" 200 612 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
212.47.246.179 - - [23/Apr/2017:03:02:45 +0800 ] "GET http://www.baidu.com/cache/gl... HTTP/1.1" 404 178 "-" "Mozilla"
95.213.187.186 - - [23/Apr/2017:03:26: 03 +0800] "CONNECT check.best-proxies.ru:80 HTTP/1.1" 400 182 "-" "-"
139.162.124.167 - - [23/Apr/2017:03:44:18 +0800] "GET / HTTP/1.1" 200 396 "-" "Mozilla/5.0"
191.96.249.97 - - [23/Apr/2017:05:39:38 +0800] "GET /phpmyadmin/scripts/setup.php HTTP/1.0" 404 178 "-" "-"
121.199.70.200 - - [23/Apr/2017:05:51:42 +0800] "GET / HTTP/1.1" 200 612 "-" "-"
111.206.36.9 - - [23/Apr/2017:06:22:26 +0800] "GET / HTTP/1.1" 200 612 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/ 537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36"


#The picture is the access location of one of the addresses. The proxy should be hung up.
allow_host=['*'] Will it have any impact on the website? Baidu said that it will be crawled by black hats, but other than that? I hope the master can do some popular science, hehe, (personal website)
Thanks to the first person in the comment area who replied and told me how to modify nginx.conf.

I find it quite interesting, so I just asked. If you need other configurations, you can reply to me in the comments

漂亮男人漂亮男人2713 days ago1068

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-16 13:20:56

    Modify the corresponding configuration in nginx.conf as follows:

    server {
        ....
        allow 192.168.1.1; # 设置你允许访问的ip
        allow 192.168.1.2;
        allow 192.168.1.3;
        deny all;  # 拒绝白名单以外的ip访问
    }
    

    reply
    0
  • Cancelreply