Skip to main content

Restricting access to the admin site by ip using nginx



If you have a static ip, and you administer the site exclusively from this address, you can restrict access to the admin panel of the site by ip. As a rule, site control panels are located in a folder (occasionally on a subdomain :) For example, WordPress has / wp-admin /. So, you need to restrict access only to this directory. In this case, the configuration code will look like this:


  location / wp-admin / {
   allow 127.0.0.1;
   deny all;
 } 

Replace 127.0.0.1 with your ip. It is important that the allow line with your ip is above the deny all line. As stated in the documentation :

... Rules are checked in the order they are written to the first match.

Similarly, with other engines. We learn the address of the admin, block in the same way.




How do you rate the article?
Звёзд: 1Звёзд: 2Звёзд: 3Звёзд: 4Звёзд: 5 (No ratings yet)
Loading...

Add a comment

Your email will not be published.