Se usiamo nginx con WordPress, possiamo proteggerlo da attacchi brute force usando l'autenticazione HTTP.
Occorre reinserire le direttive relative a PHP subito dopo aver specificato l'autenticazione HTTP. In caso contrario nginx mostrerĂ il sorgente del file.
server {
root /home/test/www;
index index.php index.html;
server_name test.tld;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
location ~ /\.ht {
deny all;
}
# Protezione di wp-login.php
location ^~ /wp-login.php {
auth_basic "Login required";
auth_basic_user_file /home/test/.htpasswd;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}