2

I have a Wordpress site running on nginx. What is the best way to restrict access to /wp-admin using nginx?

Thanks

1 Answer 1

6

As per the Nginx documentation for the access module:

location /wp-admin {
    allow 192.0.2.0/24;
    deny all;
}

That would allow access from 192.0.2.0/24 (which is presumably your administrative network) whilst denying all access from the rest of the Internet. Obviously adjust the IP range(s) as needed.

If you wanted to do HTTP authentication instead, then you might look at the documentation for the HTTP basic auth module.

On the other hand, Wordpress administration is already authentication-protected, so with strong passwords, you shouldn't have a massive amount of trouble.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .