Modify the nginx configuration file on the server
/Usr/local/nginx/CONF/nginx. conf
HTTP {
Limit_req_zone $ binary_remote_addr zone = one: 10 m rate = 3000r/m;
Proxy_cache_path/var/Cache/nginx levels = keys_zone = one: 8 m max_size = 3000 m inactive = 600 m;
Proxy_temp_path/var/tmp;
Include mime. types;
Default_type application/octet-stream;
Gzip on;
Gzip_comp_level 6;
Gzip_vary on;
Gzip_min_length 1000;
Gzip_proxied any;
Gzip_types text/plain text/HTML text/CSS application/JSON application/X-JavaScript text/XML application/XML + RSS text/JavaScript;
Gzip_buffers 16 8 K;
# Log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request "'
# '$ Status $ body_bytes_sent "$ http_referer "'
# '"$ Http_user_agent" "$ http_x_forwarded_for "';
# Access_log logs/access. Log main;
Sendfile on;
# Tcp_nopush on;
# Keepalive_timeout 0;
Keepalive_timeout 65;
# Gzip on;
Upstream wedate {
Server 10.0.0.48: 8080;
Server 10.0.0.50: 8080;
}
Server {
Listen 8080;
SERVER_NAME localhost;
# Charset koi8-r;
# Access_log logs/host. Access. Log main;
Location /{
Limit_req zone = wedate_zone burst = 30;
Proxy_redirect off;
Proxy_set_header X-real-IP $ remote_addr;
Proxy_set_header X-forwarded-for $ proxy_add_x_forwarded_for;
Proxy_set_header X-forwarded-Proto $ scheme;
Proxy_set_header host $ http_host;
Proxy_set_header X-nginx-proxy true;
Proxy_set_header connection "";
Proxy_http_version 1.1;
Proxy_cache one;
Proxy_cache_key SFS $ request_uri $ scheme;
Proxy_pass http: // wedate;
}
Nginx smooth restart,
Nginx-t-c/usr/local/nginx/CONF/nginx. conf
Configure nginx to limit IP access times