Answer the question
In order to leave comments, you need to log in
How to compactly write IP blocking rules in Nginx?
Hello.
There is a canvas with code in the /etc/nginx/sites-enabled/mysite.ru settings:
location /xmlrpc.php {
deny all;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include snippets/fastcgi-php.conf;
} }
location /wp-config.php {
allow 66.666.666.66;
allow 66.666.666.666;
deny all;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include snippets/fastcgi-php.conf;
} }
location /wp-login.php {
allow 66.666.66.66;
allow 66.666.666.666;
deny all;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include snippets/fastcgi-php.conf;
} }
location /wp-admin.php {
allow 66.666.666.66;
allow 66.666.66.666;
deny all;
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include snippets/fastcgi-php.conf;
} }
Answer the question
In order to leave comments, you need to log in
Make a php.conf file, write the php configuration there, and do include php.conf in the location. The same goes for access.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question