Welcome! Log In Create A New Profile

Advanced

location and limit_conn

Anton Gorlov
October 10, 2009 12:20PM
Что-то не получается в данной конфигурации ограничить количество
коннекций внутри определённого локейшена отличного от корня сайта.
Хотя если выставить limit_conn tor 3 в server или в
Static files location - то всё отрабатывает. но нужно ограничить внутри
/files/

В идеале ещё бы отдельно ограничить общее количество подключений к
сайту,но независимо от локейшена /files


конфигурация в аттаче


limit_zone tor $binary_remote_addr 10m;

server {
# limit_conn tor 3;
listen xx.yy.zz.243:80;
# can't use wildcards in first server_name
server_name testdomain.ru www.testdomain.ru;
access_log /dev/null;
error_page 503 /templates/503.html;

location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
allow xx.yy.zz.200;
deny all;
}

location / {
# autoindex off;
# autoindex_exact_size on;
# autoindex_localtime off;

# expires off;

# cooperate with mod_realip in apache-1.3 or mod_rpaf in apache-2.x
proxy_pass http://127.0.0.1:80/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
# proxy_pass http://back.end.addr.ess:80/;
#
# NB: it's better for URI canonicalization that apache sits on :80
# (even if that's only 127.0.0.1:80)
#
# see also set_real_ip_from, real_ip_header if this nginx
# would need to cooperate with another one acting as a frontend
}

# charset on;
# source_charset koi8-r;

# post script big limits set
location /files/ {
limit_conn tor 3;
}

# Static files location
location ~* ^.+\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|wav|bmp|rtf|js|html|iso|avi|mpg|mp3|mp4|mdf|mds)$ {
root /var/www/vhosts/tor.theon.ru/www;
}


}
Subject Author Posted

location and limit_conn

Anton Gorlov October 10, 2009 12:20PM

Re: location and limit_conn

Борис Долгов October 10, 2009 12:42PM

Re: location and limit_conn

Anton Gorlov October 11, 2009 04:22AM

Re: location and limit_conn

Борис Долгов October 12, 2009 10:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 264
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready