Restrict /wp-admin by IP

Restrict /wp-admin by IP

Hi.

I have hestiacp with an Nginx + php fpm installation on Ubuntu.

I want to modify a domain so that access to the WordPress backend is restricted to one IP.

To do this, I go to /etc/nginx/conf.d/ and edit the domain.com.conf file.

I add the lines:

location /wp-admin/ {
allow MY-IP;
deny all;
# Other configuration directives
}

I restart Nginx and php8.0-fpm, which is where the domain is located, and it has no effect.

What should I do?

Thank you.