设置单个用户的请求频率在一个合理范围内,以防止有恶意服务请求出现造成的服务宕机
设置如下:
limit_req_zone $binary_remote_addr zone=one:10m rate=30r/m;
server {
listen 80;
server_name www.anlysqx.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location /A {
proxy_pass http://one.com:8763/A;
index index.html index.htm;
limit_req zone=one;
}
设置静态资源防盗链技术配置如下:
location ~ .*\.(jpg|jpeg|JPG|png|gif|icon)$ {
valid_referers blocked http://www.itmayiedu.com www.itmayiedu.com;
if ($invalid_referer) {
return 403;
}
}