nginx: add limit_req delay
nginx.conf: add resolver
This commit is contained in:
parent
3e9e41bdeb
commit
f56fafd7e0
@ -1,44 +1,47 @@
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
error_log /var/log/nginx/error.log notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
|
||||
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=30r/s;
|
||||
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
|
||||
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=30r/s;
|
||||
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
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 off;
|
||||
access_log off;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
#gzip on;
|
||||
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
# Compression
|
||||
gzip on;
|
||||
gzip_min_length 1000;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 1;
|
||||
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
|
||||
gzip_vary on;
|
||||
gzip_disable "msie6";
|
||||
# Compression
|
||||
gzip on;
|
||||
gzip_min_length 1000;
|
||||
gzip_proxied any;
|
||||
gzip_comp_level 1;
|
||||
gzip_types text/css text/javascript text/xml text/plain text/x-component application/javascript application/json application/xml application/rss+xml font/truetype font/opentype application/vnd.ms-fontobject image/svg+xml;
|
||||
gzip_vary on;
|
||||
gzip_disable "msie6";
|
||||
|
||||
|
||||
resolver 127.0.0.11 ipv6=off;
|
||||
}
|
||||
@ -23,6 +23,10 @@ server {
|
||||
include /etc/nginx/mime.types;
|
||||
|
||||
|
||||
limit_req zone=req_limit_per_ip burst=10 delay=30;
|
||||
limit_conn conn_limit_per_ip 30;
|
||||
|
||||
|
||||
error_page 401 /login;
|
||||
|
||||
|
||||
@ -47,9 +51,6 @@ server {
|
||||
}
|
||||
|
||||
location / {
|
||||
limit_req zone=req_limit_per_ip burst=10;
|
||||
limit_conn conn_limit_per_ip 30;
|
||||
|
||||
proxy_pass http://app;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
|
||||
@ -9,9 +9,11 @@ server {
|
||||
listen 80;
|
||||
include /etc/nginx/mime.types;
|
||||
|
||||
|
||||
limit_req zone=req_limit_per_ip burst=10 delay=30;
|
||||
limit_conn conn_limit_per_ip 30;
|
||||
|
||||
location / {
|
||||
limit_req zone=req_limit_per_ip burst=10;
|
||||
limit_conn conn_limit_per_ip 30;
|
||||
|
||||
proxy_pass http://app;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user