Nginx 블랙리스트 설정
author: headsen chen
공지: 개인 오리지널
1. 도 메 인 이름 아래 에 설정:
[root@pro-nginx:/usr/local/openresty/nginx/conf/sites]$cat www.ceshi.com.conf 
geo $remote_addr $black {
    121.35.3.0/24 1;
    121.35.2.0/24 1;
    121.35.1.0/24 1;
    121.35.0.0/24 1;
    112.97.63.0/24 1;
    112.97.50.0/24 1;
    211.101.18.214 1;
    124.232.148.90 1;
    118.193.154.149 1;
    140.240.23.99 1;
}
server {
    listen       80;
    listen      443 ssl;
    include      ceshi-ssl-ev.conf;
    server_name  www.ceshi.com;  2. 도 메 인 이름 아래 에 설정 (일치 하 는 항목 아래 에 설정):
location / {
  deny  192.168.1.1;
  allow 192.168.1.0/24;
  allow 10.1.1.0/16;
  allow 2001:0db8::/32;
  deny  all;
  proxy_pass http://10.1.1.1:2000;
}  3. Nginx 의 전체 입구 에 접근 ip 제한 을 설정 하고 화이트 리스트 에 있 는 것 만 접근 할 수 있 습 니 다.
[root@beta-usrv01:/usr/local/openresty/nginx/conf]$cat nginx.conf
user fmservice;
worker_processes  auto;
events {
    worker_connections  102400;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server_names_hash_bucket_size 128;
    log_format  main  '$remote_addr [$time_local] "$host" "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" '
                      '"$request_time:$upstream_response_time" $upstream_addr "$upstream_status" "$upstream_cache_status"';
    client_max_body_size 50m;
    gzip on;
    gzip_types    text/plain application/javascript application/x-javascript text/xml text/css image/png image/jpg image/gif image/jpeg;
    gzip_vary off;
    geo $remote_addr $whitelist {
        default 0;
        127.0.0.1 1;
        172.0.0.0/8 1;
        10.0.0.0/8 1;
        119.189.0.0/16 1;
        113.169.0.0/16 1;
        139.108.102.77 1;
        112.174.61.155 1;
        120.178.139.70 1;
......
    }
    map $http_x_app_info $appheader {
    default "";
    }
}
      :
  [root@metabase:/usr/local/openresty/nginx/conf]$cat nginx.conf
worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr [$time_local] "$host" "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" '
                      '"$request_time:$upstream_response_time" $upstream_addr "$upstream_status" "$upstream_cache_status"';
    access_log  logs/access.log  main;
    error_log   logs/error.log;
    sendfile        on;
    keepalive_timeout  65;
    include whiteiplist.conf;
    server {
        listen       80;
        server_name  aaaa.bbbbbbl.com default;
        access_log /var/log/nginx/aaaaa.bbbbbbl.com.log main;
        if ( $whitelist != 1 ) {
            return 403;
            #set $fasdbfad 1;
        }  [root@metabase:/usr/local/openresty/nginx/conf]$cat whiteiplist.conf 
        geo $remote_addr $whitelist {
        default 0;
        101.232.131.102 1;
        124.42.150.166 1;
        117.136.40.216 1;
        }  다음으로 전송:https://www.cnblogs.com/kaishirenshi/p/11132975.html
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.