ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

limit_req


  • To: nginx-ru@xxxxxxxxx
  • Subject: limit_req
  • From: "xganet" <nginx-forum@xxxxxxxx>
  • Date: Sat, 20 Aug 2011 04:56:33 -0400
  • Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mickey.jlkhosting.com; s=x; h=Date:Sender:From:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To; bh=akNMWCW1oVkdzvwKiEyZSbWF49vIrnraYIYQdVvW12M=; b=mFw4YtGf9DJaBASVCvfl4Ul/9F2iLRzNGltLCFyM60q3mBpvR1L3znAb1aAslws4VoMO0MdAI7YokRgjbq7Q4TAImeJLx/gOM/0wVniGpEp961QSGIkjEKQCVUFBuFFR;

Подскажите правильно ли размещена
строка:
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 mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.