NGINX: Block URL Access (wp-admin/wp-login.php) To All Except One IP Address

Append the following all and deny all NGINX config directives in server context:

location ~ ^/(wp-admin|wp-login\.php) {
   allow 1.2.3.4;
   deny all;
}Code language: Nginx (nginx)

If your blog located in /blog/ sub-directory, try:

location ~ ^/blog/(wp-admin|wp-login\.php) {
   allow 1.2.3.4;
   deny all;
}Code language: Nginx (nginx)

Reference: https://www.cyberciti.biz/faq/nginx-block-url-access-all-except-one-ip-address/


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.