Welcome! Log In Create A New Profile

Advanced

Ограничение частых запросов

January 17, 2017 12:49PM
Здравствуйте.
Вот конфигурационный файл nginx:
server {
server_name site.ru;
listen 12.345.67.890:80;

charset UTF-8;
disable_symlinks if_not_owner from=$root_path;

index index.html index.php;
root $root_path;
set $root_path /var/www/site1/data/www/site.ru;
include /etc/nginx/vhosts-includes/*.conf;
client_max_body_size 64M;

location ^~ /core/ {
try_files error-404 @modx;
}

location ^~ /config.core.php {
try_files error-404 @modx;
}

location ~* ^.+\.(css|js|svg|jpg|jpeg|gif|png|ico|zip|rar|doc|xls|pdf|exe|wav|bmp|rtf)$ {
client_max_body_size 128M;
access_log off;
expires 7d;
break;
}

location / {
try_files $uri $uri/ @modx;
location ~ [^/]\.ph(p\d*|tml)$ {
try_files /does_not_exists @php;
}
}

location @modx {
limit_req zone=one burst=3;
rewrite ^/(.*)$ /index.php?q=$1&$args;
}

location @php {
fastcgi_index index.php;
fastcgi_buffers 8 16k;
fastcgi_pass unix:/var/www/php-fpm/site1.sock;
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
try_files $uri @modx;
include fastcgi_params;
}
}
Есть следующая проблема: при нахождении файла в корневой директории его нужно обрабатывать по правилу location @modx и затем через fastcgi (это может быть как файл с расширением php, так и файл без расширения), частые запросы нужно ограничить. Если файл находится в папках /assets, /manager, /connectors и имеет расширение php, то его также нужно пропустить через fastcgi, при этом частота запросов к нему не должна быть ограничена. Не пойму как правильно составить правила обработки. Можете ли посоветовать какой-либо вариант?
Subject Author Posted

Ограничение частых запросов

Vvedensky January 17, 2017 12:49PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 181
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready