IP filtering protection on the login page with NGINX

If there is no other users that login on your websites but your team, you may want to filter the IP that can access the login pages.

On NGINX, this is done by adding location rules in your server block:

    
server {
    ...

    #login protection
    location /user/login {
        allow 92.127.254.0/24; #Domain
        allow 191.40.194.126; #IP
        try_files $uri /index.php?$query_string;
    }
    .....
    
}

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.