Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
В настройке обязательно включите галочку «За прокси» — иначе он будет для всех определять ip вашего сервера и автомат блокировать всех.
What is this option about site connection and reverse proxy?
A reverse proxy is a server in between the site and the Internet (perhaps handling caching or load-balancing). This makes getting the correct client IP to block slightly more complicated.The option default to NOT being behind a proxy — which should be by far the common case.
proxy_set_header X_REAL_IP $remote_addr;
proxy_set_header X_FORWARDED_FOR $proxy_add_x_forwarded_for;
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1
RPAFheader X-REAL-IP
location ~* /(wp-login\.php|administrator|admin\.php) {
set $humantest 0;
if ($http_cookie !~* "humans=checktest") {
set $humantest 1;
}
if ($args ~* (callback|logout|lostpassword)) {
set $humantest 0;
}
if ($humantest = 1) {
add_header Content-Type text/html;
return 200 "<html><body><script>document.cookie='humans=checktest;path=/';location.reload();</script></body></html>";
}
error_page 404 = @fallback;
}
HTTP/1.1 200 OK
...
Content-Type: application/octet-stream
Content-Length: 103
Connection: keep-alive
Keep-Alive: timeout=5
Content-Type: text/html
... location ~* /(wp-login\.php|administrator|admin\.php) {
default_type text/html;
set $humantest 0;
if ($http_cookie !~* "humans=checktest") {
set $humantest 1;
}
if ($args ~* (callback|logout|lostpassword)) {
set $humantest 0;
}
if ($humantest = 1) {
return 200 "<html><body><script>document.cookie='humans=checktest;path=/';location.reload();</script></body></html>";
}
error_page 404 = @fallback;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 120;
include fastcgi_params;
}
#Защита от подбора пароля
<Files wp-login.php>
Order Deny,Allow
Deny from all
allow from домашний_ip
allow from рабочий_ip
</Files>
# protect xmlrpc
<Files xmlrpc.php>
Order Deny,Allow
Deny from all
</Files>
И опять атака на сайты Wordpress — перебор + XMLRPC