Ну вот чел писал
# Вообще разрываем соединения с теми кто лезет по HTTP/1.0, если он не поисковик. По своим логам делаю вывод что по HTTP/1.0 опрашивает роботс тролько майл ру. Все остальное плохие боты.
map "$whitelist:$server_protocol" $bad_bot {
default 0;
"0:HTTP/1.0" 1;
}
Ты можешь сказать как это настроить, куда вставить правильно? Именно в мой файл конфига
Там нету секции локатион у меня ,я скинул выше как у меня файл выглядит---------- Добавлено 22.12.2019 в 08:32 ----------Можешь сказать куда вставлять коды типа:
map "$whitelist:$server_protocol" $limit1 {
"1:HTTP/1.0" "";
"1:HTTP/1.1" "";
"1:HTTP/2.0" "";
"0:HTTP/1.1" "$binary_remote_addr";
limit_req_zone $limit1 zone=bot11:10m rate=7r/m;
if ($bad_bot) {
return 444;
if ($bad_useragent) {
Выше я скинул как выглядит мой файл
И как я вставил скрин
https://hostingkartinok.com/show-image.php?id=e2a75b5147aebbede3f2ecef388b56d8
Ну скрипт да старый стоит на сервере, базара нет)) но какой есть)) Про HTTP/1.0 теперь буду знать, что старый спс. А вот в сам файл nginx.conf куда имеено вставить этот код в сексцию Http? После строчки limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;
Или куда, уточните пж, чтоб он работал
Nginx.conf сейчас выглядит так:
# Server globals
user www-data;
worker_processes auto;
worker_rlimit_nofile 100000;
timer_resolution 50ms; #In order to free some CPU cycles
error_log /var/log/nginx/error.log crit;
pid /var/run/nginx.pid;
# Worker config
events {
worker_connections 60000;
use epoll;
multi_accept on;
http {
# Main settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
client_header_timeout 10;
client_body_timeout 10;
client_header_buffer_size 2k;
client_body_buffer_size 5k;
client_max_body_size 10k;
large_client_header_buffers 4 8k;
send_timeout 10;
keepalive_timeout 5 5;
reset_timedout_connection on;
server_tokens off;
server_name_in_redirect off;
server_names_hash_max_size 512;
server_names_hash_bucket_size 512;
limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;
# Log format
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 bytes '$body_bytes_sent';
#access_log /var/log/nginx/access.log main;
access_log off;
# Mime settings
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Compression
gzip on;
gzip_vary on;
gzip_comp_level 7;
gzip_min_length 512;
gzip_buffers 8 64k;
gzip_types text/plain text/css text/javascript text/js text/xml application/json application/javascript application/x-javascript application/xml application/xml+rss application/x-font-ttf image/svg+xml font/opentype;
gzip_proxied any;
gzip_disable "MSIE [1-6]\.";
# Proxy settings
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;
# Cloudflare https://www.cloudflare.com/ips
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 162.158.0.0/15;
set_real_ip_from 172.64.0.0/13;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32;
set_real_ip_from 2c0f:f248::/32;
set_real_ip_from 2a06:98c0::/29;
real_ip_header CF-Connecting-IP;
# SSL PCI Compliance
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
# Error pages
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 502 503 504 /error/50x.html;
# Cache settings
proxy_cache_path /var/cache/nginx levels=2 keys_zone=cache:10m inactive=60m max_size=1024m;
proxy_cache_key "$host$request_uri $cookie_user";
proxy_temp_path /var/cache/nginx/temp;
proxy_ignore_headers Expires Cache-Control;
proxy_cache_use_stale error timeout invalid_header http_502;
proxy_cache_valid any 1d;
# Cache bypass
map $http_cookie $no_cache {
~SESS 1;
~wordpress_logged_in 1;
# File cache settings
open_file_cache max=10000 inactive=30s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
# Wildcard include
include /etc/nginx/conf.d/*.conf;
}---------- Добавлено 22.12.2019 в 08:01 ----------Я нашел в инете еще вот
Скиньте пожалуйста на моем примере файле нгинс.конф куда вставлять данные строчки правильно)))---------- Добавлено 22.12.2019 в 08:02 ----------И спрасибо большое, что помогаете---------- Добавлено 22.12.2019 в 08:02 ----------СПасибо большое, что помогаете!)
Что если ограничить через этот код именно те запросы, типа GET /?1576996901 которые флуд каждую секунду, а другие запросы, чтоб проходили GET, которые не флуд вставить их в этот код и если это поможет как правильно вставить код этот
# vi /etc/nginx/nginx.conf
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
В мой файл?
Бро как мне правильно добавить этот
код
В какую секцию вписать?
А можно туда запросы добавить эти, типа таких которые идут GET /?1576959936?? Или туда ток реферы можн овставлять?
Просто я вставил туда реферы, но чет такие же запросы реферы продолжают флудить(
и дальше уже через | записывать всех плохих реферов, главное смотрите, чтобы части были именно большие и уникальные, а то можно так забанить и хороших
ПОнимаете я новичок, мне надо разжововать, чтоб понять че и как куда точно писать, мне сказали еще настроить файл
sysctl.conf
Там сейчас так: после того как туда добавляешь строчки, в консоли вводить команду sudo sysctl -p и настройки применяются?
Я после этого перезагрузил сервер, вроде трафик флуда упал
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#kernel.domainname = example.com
# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3
##############################################################3
# Functions previously found in netbase
# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.tcp_keepalive_time = 60
net.ipv4.tcp_keepalive_probes = 5
# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1
# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1
# Uncomment the next line to enable packet forwarding for IPv6
# Enabling this option disables Stateless Address Autoconfiguration
# based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1
###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.core.rmem_max = 996777216
net.core.wmem_max = 996777216
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_mem= 786432 1048576 996777216
net.ipv4.tcp_wmem = 4096 87380 4194304
net.ipv4.tcp_max_orphans = 2255360
net.core.netdev_max_backlog = 10000
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_intvl = 15
net.ipv4.tcp_max_syn_backlog = 2048
net.ipv4.tcp_synack_retries = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 494967295
kernel.shmall = 268435456
net.core.somaxconn= 16096
А на счет файла нгинс.конф
это я так и не понял как правильн туда код писать, сейчас там просто строчка limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;---------- Добавлено 21.12.2019 в 18:39 ----------
Я крч вот так добавил, смотрел реферы, хз как еще, правильно код написан? После добавления кода в нгинс.конфиг больше ниего не нужно, перезагружать нгинс или сервер?
СКрин https://hostingkartinok.com/show-image.php?id=dfe59d80a79fe4b7c4ee7db262cc3e92
А где его нанять?---------- Добавлено 21.12.2019 в 16:27 ----------И эта уязвимость реферы, это из за скрипта наверное да, котоырй стоит на сервере
Мне нужны примеры
Если вот еще рефер надо добавить "http://www.online-translator.com/url/translation.aspx?direction=er&sourceURL=http://мой ип/"
то писать в код как этот рефер, как сокращать его, можно пример с этим рефером?
Ну я написал еще другой рефер, можете сделать пример кода как два рефера добавить? Чтоб я дальше сам уже добавлял