
确保你和你的网站管理员采取以下预防措施:
配置 HTTPS:使用 HTTPS 可以帮助防止别人在传输过程中拦截你的数据。同时也建议启用 HSTS。
设置正确的权限:确保你的网站目录不允许其他用户访问,并限制文件的权限。
安装防火墙或安全插件:使用防火墙或安全插件可以防止恶意的 IP 地址或请求,并自动屏蔽或拦截它们。
禁用目录浏览:确保在你的服务器或 WordPress 设置中禁用目录浏览功能。
常规更新:确保 WordPress 及其插件 / 主题及时更新,以避免利用已知漏洞进行攻击。
检查日志:定期检查日志以查找可疑的访问和行为。
如果你决定禁用 Nginx 反向代理的话,可以在 Nginx 配置中添加以下代码:
location / {
proxy_pass http://your_wordpress_site_url;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
在你的 WordPress 配置中,添加以下代码:
if ( $_SERVER['HTTP_X_REAL_IP'] == 'the_Nginx_server_IP' ) {
exit;
}
这段代码将检查 HTTP 头中的 X-Real-IP 值是否等于 Nginx 服务器的 IP 地址,如果是则退出程序,从而防止 Nginx 反向代理。
- All rights reserved.
- No part of this website, including text and images, may be reproduced, modified, distributed, or transmitted in any form or by any means, without the prior written permission of the author.
- Unauthorized commercial use is strictly prohibited.
- Unauthorized personal use is strictly prohibited.