Wordpress 如何隐藏wp admin AWS NginX

Wordpress 如何隐藏wp admin AWS NginX,wordpress,amazon-web-services,nginx,amazon-elb,Wordpress,Amazon Web Services,Nginx,Amazon Elb,我有一个wordpress网站,我想限制对管理员页面的访问。服务器位于ELB后面的AWS中。我正在服务器{}之间的.conf文件中设置location指令。我设置的配置不起作用,因为我仍然可以从应该被拒绝的ip地址访问页面 有人能给我看一下并给我一些指导吗?谢谢大家! location ~ ^/(wp-admin\.php) { real_ip_header X-Forwarded-For; set_real_ip_from xxx.xxx.xxx.xxx; allow xxx.xxx.x

我有一个wordpress网站,我想限制对管理员页面的访问。服务器位于ELB后面的AWS中。我正在服务器{}之间的.conf文件中设置location指令。我设置的配置不起作用,因为我仍然可以从应该被拒绝的ip地址访问页面

有人能给我看一下并给我一些指导吗?谢谢大家!

location ~ ^/(wp-admin\.php) { 
real_ip_header X-Forwarded-For; 
set_real_ip_from xxx.xxx.xxx.xxx; 
allow xxx.xxx.xxx.xxx; 
deny all; 
}

使用下面的代码使您的用例工作

location ~ ^/(wp-admin|wp-login.php) {
real_ip_header X-Forwarded-For; 
allow xx.xx.xx.xx;
deny all;
}