limit_req
xganet
nginx-forum на nginx.us
Сб Авг 20 08:56:33 UTC 2011
Подскажите правильно ли размещена
строка:
limit_req zone=one burst=10;
или же её надо в секцию:
location / {
.........
.........
}
Мой конфиг:
user www-data;
worker_processes 1;
worker_rlimit_nofile 80000;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 51200;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
include /etc/nginx/sites-enabled/*;
limit_req_zone $binary_remote_addr zone=one:10m rate=20r/s;
client_max_body_size 16m;
log_format isp '$bytes_sent $request_length';
server {
listen 99.228.228.222:80;
server_name site1.ru www.site1.ru;
limit_req zone=one burst=10;
rewrite ^(/manager/.*)$ https://$host$1 permanent;
rewrite ^(/manager/.*)$ https://$host$1 permanent;
error_page 404 = @fallback;
location ~* ^/(webstat/|awstats|webmail/|myadmin/|manimg/) {
proxy_pass http://99.228.228.222:8080;
proxy_redirect http://site1.ru:8080/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
proxy_pass http://99.228.228.222:8080;
proxy_redirect http://site1.ru:8080/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location ~*
^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ {
root /var/www/p17267_you/data/www/site1.ru;
access_log /var/www/httpd-logs/site1.ru.access.log ;
access_log /var/www/nginx-logs/p17267_you isp;
}
location @fallback {
proxy_pass http://99.228.228.222:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
server {
listen 99.228.228.222:80;
server_name site2.ru www.site2.ru;
limit_req zone=one burst=25;
rewrite ^(/manager/.*)$ https://$host$1 permanent;
rewrite ^(/manager/.*)$ https://$host$1 permanent;
error_page 404 = @fallback;
location ~* ^/(webstat/|awstats|webmail/|myadmin/|manimg/) {
proxy_pass http://99.228.228.222:8080;
proxy_redirect http://site2.ru:8080/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
proxy_pass http://99.228.228.222:8080;
proxy_redirect http://site2.ru:8080/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location ~*
^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ {
root /var/www/p17267_you/data/www/site2.ru;
access_log /var/www/httpd-logs/site2.ru.access.log ;
access_log /var/www/nginx-logs/p17267_you isp;
}
location @fallback {
proxy_pass http://99.228.228.222:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?21,214071,214071#msg-214071
Подробная информация о списке рассылки nginx-ru