5 个让你的 WordPress 网站安全的技巧
WordPress 安全 插件
![](/data/attachment/album/201702/15/084042u0fieziej0uljpus.jpg)


WordPress 是迄今为止最流行的博客平台。


正由于它的流行，也因此带来了正面和负面的影响。事实上，几乎每个人都使用它，使它更容易被发现漏洞。WordPress 的开发人员做了很多工作，一旦新的缺陷被发现，就会发布修复和补丁，但这并不意味着你可以安装完就置之脑后。


在这篇文章中，我们将提供一些最常见的保护和强化 WordPress 网站的方法。


### 在登录后台时总是使用 SSL


不用说的是，如果你并不打算只是做一个随意的博客，你应该总是使用 SSL。不使用加密连接登录到你的网站会暴露你的用户名和密码。任何人嗅探流量都可能会发现你的密码。如果你使用 WiFi 上网或者连接到一个公共热点，那么你被黑的几率更高，这是特别真实的。你可以从[这里](https://letsencrypt.org/)获取受信任的免费 SSL 证书。


### 精心挑选附加的插件


由第三方开发人员所开发，每个插件的质量和安全性总是值得怀疑，并且它仅取决于其开发人员的经验。当安装任何额外的插件时，你应该仔细选择，并考虑其受欢迎程度以及插件的维护频率。应该避免维护不良的插件，因为它们更容易出现易于被利用的错误和漏洞。


此主题也是上一个关于 SSL 主题的补充，因为许多插件包含的脚本会发出不安全连接（HTTP）的请求。只要你的网站通过 HTTP 访问，一切似乎很好。但是，一旦你决定使用加密并强制使用 SSL 访问，则会立即导致网站的功能被破坏，因为当你使用 HTTPS 访问其他网站时，这些插件上的脚本将继续通过 HTTP 提供请求。


### 安装 Wordfence


Wordfence 是由 Feedjit Inc. 开发的，Wordfence 是目前最流行的 WordPress 安全插件，并且是每个严肃的 WordPress 网站必备的，特别是那些使用 WooCommerce 或其它的 WordPress 电子商务平台的网站。


Wordfence 不只是一个插件，因为它提供了一系列加强您的网站的安全功能。它具有 web 程序防火墙、恶意软件扫描、实时流量分析器和各种其它工具，它们可以提高你网站的安全性。防火墙将默认阻止恶意登录尝试，甚至可以配置为按照 IP 地址范围来阻止整个国家/地区的访问。我们真正喜欢 Wordfence 的原因是，即使你的网站因为某些原因被侵害，例如恶意脚本，Wordfence 可以在安装以后扫描和清理你的网站上被感染的文件。


该公司提供这个插件的免费和付费订阅计划，但即使是免费计划，你的网站仍将获得令人满意的水平。


### 用额外的密码锁住 /wp-admin 和 /wp-login.php


保护你的 WordPress 后端的另一个步骤是使用额外的密码保护任何除了你以外不打算让任何人使用的目录（即URL）。 /wp-admin 目录属于此关键目录列表。 如果你不允许普通用户登录 WordPress，你应该使用密码限制对 wp.login.php 文件的访问。无论是使用 [Apache](/article-5731-1.html) 还是 [Nginx](/article-5229-1.html)，你都可以访问这两篇文章，了解如何额外保护 WordPress 安装。


### 禁用/停止用户枚举


这是攻击者发现你网站上的有效用户名的一种相当简单的方法（即找出管理员用户名）。那么它是如何工作的？这很简单。在任何 WordPress 站点上的主要 URL 后面跟上 `/?author=1` 即可。 例如：`wordpressexample.com/?author=1`。


要保护您的网站免受此影响，只需安装[停止用户枚举](https://wordpress.org/plugins/stop-user-enumeration/)插件。


### 禁用 XML-RPC


RPC 代表远程过程调用，它可以用来从位于网络上另一台计算机上的程序请求服务的协议。对于 WordPress 来说，XML-RPC 允许你使用流行的网络博客客户端（如 Windows Live Writer）在你的 WordPress 博客上发布文章，如果你使用 WordPress 移动应用程序那么也需要它。 XML-RPC 在早期版本中被禁用，但是从 WordPress 3.5 时它被默认启用，这让你的网站面临更大的攻击可能。虽然各种安全研究人员建议这不是一个大问题，但如果你不打算使用网络博客客户端或 WP 的移动应用程序，你应该禁用 XML-RPC 服务。


有多种方法可以做到这一点，最简单的是安装[禁用 XML-RPC](https://wordpress.org/plugins/disable-xml-rpc/)插件。




---


via: <https://www.rosehosting.com/blog/5-tips-for-securing-your-wordpress-sites/>


作者：<rosehosting.com> 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
We’ll show you, How to Secure a WordPress Site. WordPress is by far the most popular blogging platform today. Being as popular as it is, it comes with its own strengths and weaknesses. The very fact that almost everybody uses it, makes it more prone to vulnerabilities. WordPress developers are doing a great job of fixing and patching the framework as new flaws are discovered, but that doesn’t mean that you can simply install and forget your installation. In this post, we will provide some of the most common ways of securing and strengthening a WordPress site. Securing a WordPress site is fairly easy task, just carefully follow this tutorial bellow.

Table of Contents

## 1. Always use SSL when logging into your back-end

It goes without saying that you should always implement SSL if you are planning to do anything more than just a casual blog. Logging in onto your site without using an encrypted connection exposes your username and your password on the clear. Anyone sniffing traffic at the moment could discover your password. This is especially true if you are surfing on a WiFi or if you are connected to a public hotspot, then the chances that you will get hacked are even higher. Get a [trusted SSL certificate](https://www.rosehosting.com/ssl-certificates.html).

## 2. Be picky about any additional plugins

Being developed by 3rd party developers, the quality and security of each plugin is always questionable and depends solely on the experience of its developer. When installing any additional plugins one should carefully choose the plugin and take into consideration its popularity as well as how often is the plugin being maintained. Poorly maintained plugins should be avoided as they are more prone to bugs and vulnerabilities which can be easily exploited.

This topic is also as an addition to the previous topic about the SSL, since many plugins are incorrectly developed to the degree that they contain scripts that explicitly request insecure (HTTP) connections. Everything seems fine as long as your site is accessed via HTTP. However, once you decide to implement encryption and force the SSL access, that will immediately result in a broken site, because the scripts on these plugins will continue to serve out their requests via HTTP, when the rest of your site is accessed with HTTPS.

## 3. Install Wordfence

Being developed by Feedjit Inc., Wordfence is the most popular WordPress security plugin today and a must-have for every serious WordPress site, especially for those that utilize [WooCommerce](https://www.rosehosting.com/woocommerce-hosting.html) or another WordPress eCommerce platform. Wordfence is not just a plugin as it rather offers a collection of security features that will strengthen your site. It features a web application firewall, malware scanner, live traffic analyzer and a variety of additional tools which can improve the security of your site. The firewall will block malicious login attempts by default, and can even be configured to block entire countries by their IP Address ranges. What we really like about Wordfence is that even if your site is compromised for some reason i.e. with malicious scripts, Wordfence can be installed afterward to scan and clean your site from the infected files.

The company offers free and paid subscription plans of the plugin, but even with the free plan, your site will be secured on a satisfactory level.

## 4. Lockdown /wp-admin and /wp-login.php with an additional password

Another step toward protecting your WordPress backend would be to additionally password protect any directories (read URLs) which are not meant to be used by anyone else except you. The /wp-admin directory is on this list of critical directories already. If you don’t allow WordPress login for the normal users you should restrict the wp.login.php file with an additional password. Whether you use [Apache ](https://www.rosehosting.com/blog/password-protect-a-directory-using-htaccess/)or [Nginx](https://www.rosehosting.com/blog/password-protecting-directories-with-nginx/), you can visit those two articles to learn how to additionally secure your WordPress installation.

## 5. Disable/stop user enumeration

This is a fairly easy way for an attacker to discover valid usernames on your site, (read to find out the admin username). So how does it work? It’s simple. On any WordPress site put the /?author=1 after the main URL. An example would be: wordpressexample.com/?author=1

To protect your site from this, simply install the [Stop User Enumeration](https://wordpress.org/plugins/stop-user-enumeration/) plugin.

## 6. Disable XML-RPC

RPC stands for Remote Procedure Calls, it’s a protocol that one program can use to request a service from a program located on another computer on a network. In terms of WordPress, XML-RPC allows you to post on your WordPress blog using popular weblog clients like Windows Live Writer but it is also needed if you are using the WordPress mobile app. XML-RPC used to be disabled in the earlier versions but since WordPress version 3.5 it is enabled by default which allows for a greater attack surface on your site. Although various security researchers are advising that this is not that of a big deal, if you do not intend on using web-blog clients or the WP Mobile App, you should disable the XML-RPC service.

There are multiple ways to do this and the simplest would be to just install the [Disable XML-RPC](https://wordpress.org/plugins/disable-xml-rpc/) plugin.

Of course, you don’t have to secure your WordPress site if you use one of our [WordPress VPS Hosting services](https://www.rosehosting.com/wordpress-hosting.html), in which case you can simply ask our expert Linux admins to **set up and secure your WordPress blog**. They are available 24×7 and will take care of your request immediately.

**PS.** If you liked this post, on how to secure a WordPress site, please share it with your friends on the social networks using the sharing buttons or simply leave a reply below. Thanks.

Don’t forget to setup 2FA (two factor auth) on your wp logins.

Reply