To block access to the URL wp-admin/wp-login.php
for all IP addresses except one in nginx
, you can use the following configuration in the server block for the website:
location /wp-admin/wp-login.php {
allow 192.168.1.100;
deny all;
}
This configuration uses the location
directive to specify the URL to be restricted. The allow
directive allows access to the URL from the IP address 192.168.1.100
. The deny
directive denies access to all other IP addresses.
Make sure to replace 192.168.1.100
with the IP address that you want to allow access to the URL.
Don’t forget to restart Nginx after making changes to the configuration file.