如何隐藏 wp-admin AWS NginX

3
我有一个WordPress站点,希望限制访问管理员页面。服务器位于 AWS 后面的 ELB 上。我正在在 .conf 文件中的 server {} 之间设置 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; 
}
1个回答

1
使用以下内容使您的用例正常工作。
location ~ ^/(wp-admin|wp-login.php) {
real_ip_header X-Forwarded-For; 
allow xx.xx.xx.xx;
deny all;
}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接