加快WordPress网站的12种方法

Speed is a quality that all websites or services should possess, and WordPress is no exception. You never get a second chance to make a first impression, so it’s important to ensure that you in no way leave your visitors with any reason to leave your site even before it’s even finished loading, or reasons that could make them want to never return.

速度是所有网站或服务都应具备的质量,WordPress也不例外。 您永远不会有第二次机会留下深刻的印象,因此,重要的是要确保您甚至在加载完成之前,都不会以任何理由离开您的访客,甚至是在访客无法回访之前也不会离开您的网站。

In this article, I’ll show you how to effectively improve your WordPress site load speed, with twelve of the best approaches that will help improve your performance. If you need more convincing why site speed is critical, check out our previous article that talks about why site speed matters.

在本文中,我将向您展示如何有效地利用十二种最佳方法来提高WordPress网站的加载速度。 如果您需要更多有说服力的理由说明站点速度为何如此关键,请查阅我们之前的文章,其中讨论了站点速度为何如此重要 。

选择一个好的主人 (Choosing a Good Host)

Your choice of web host has a big impact on your site speed. A good web host is the foundation where your website runs, it’s the first aspect to be addressed when working on improving site speed (even if not a WordPress powered site).

您选择的虚拟主机对您的网站速度有很大的影响。 一个好的虚拟主机是您网站运行的基础,这是提高网站速度(即使不是由WordPress驱动的网站)时要解决的第一个方面。

There are numerous hosting companies out there, it’s a highly competitive market and worth shopping around. Charles Costa has covered this topic extensively, the following articles will help point you in the right direction and help you make an informed choice when selecting a hosting provider.

那里有许多托管公司,这是一个竞争激烈的市场,值得四处逛逛。 Charles Costa广泛讨论了此主题,以下文章将帮助您指出正确的方向,并帮助您在选择托管服务提供商时做出明智的选择。

  • How to Separate the Good WordPress Hosts from the Bad

    如何将好的WordPress主机与坏的分开

  • Managed WordPress Hosting: The Pros and Cons

    托管WordPress托管:利弊

  • Review Signal WordPress Hosting Report Summary

    查看Signal WordPress托管报告摘要

使用CDN (Using a CDN)

A Content Delivery Network or Content Distribution Network (CDN) is a system of distributed servers that deliver web pages and other web resources to a user based on his/her geographical location.

内容交付网络内容分发网络 (CDN)是一个分布式服务器系统,可根据用户的地理位置向用户交付网页和其他Web资源。

A CDN typically copies all the static files (CSS, JavaScript, media files etc.) in use on your website and delivers them to users as fast as possible.

CDN通常会复制您网站上正在使用的所有静态文件(CSS,JavaScript,媒体文件等),并尽快将其交付给用户。

This article by Jacco Blankenspoor takes a closer look at WordPress and CDNs.

雅克·布兰肯斯普(Jacco Blankenspoor)的这篇文章仔细研究了WordPress和CDN。

快取 (Caching)

Caching is the temporary storage of content such as pages, image and other files used to render your page. This content is saved on visitor’s local drive as a cache, so when they are requested again by the same visitors, they are rendered much faster. Caching also happens on the server. It’s a technical area, but there are several popular WordPress plugins that help you configure and manage caching very easily, the most popular choices are W3 Total Cache and WP Super Cache.

缓存是内容的临时存储,例如页面,图像和其他用于呈现页面的文件。 此内容作为缓存保存在访问者的本地驱动器上,因此当同一访问者再次请求它们时,它们的呈现速度将大大提高。 缓存也发生在服务器上。 这是一个技术领域,但是有几个流行的WordPress插件可以帮助您非常轻松地配置和管理缓存,最受欢迎的选择是W3 Total Cache和WP Super Cache 。

缩小CSS和JavaScript文件 (Minify CSS and JavaScript Files)

The process of ‘minifying’ your CSS and JavaScript files compresses the original files to the smallest possible sizes, thereby improving the speed at which browser retrieves the files.

“最小化” CSS和JavaScript文件的过程会将原始文件压缩到尽可能小的大小,从而提高了浏览器检索文件的速度。

YUI Compressor will come in handy if you prefer a manual approach to minifying your site CSS and JavaScript files, or you can go for WP Minify which handles the work with an automated approach. Some caching plugins also offer minification as a feature.

如果您希望使用手动方法来缩小站点CSS和JavaScript文件的大小, YUI Compressor将派上用场,或者您可以选择WP Minify ,它可以自动处理工作。 一些缓存插件还提供缩小功能。

压缩影像 (Compressing Images)

Apart from the fact that large image files contributes greatly to the sluggishness of a WordPress site, they also consume bandwidth too. Images are a good candidate for optimization.

除了大型图像文件在很大程度上导致WordPress网站运行缓慢之外,它们还消耗带宽。 图像是优化的理想选择。

Using the free WPMU DEV WordPress Smush API, the WP SmushIt plugin will help you reduce the size of these images without compromising their quality. I use this plugin and find it amazing how much it reduces image sizes.

使用免费的WPMU DEV WordPress Smush API, WP SmushIt插件将帮助您减小这些图像的大小而不会影响其质量。 我使用此插件,发现它惊人地减小了图像大小。

加快WordPress网站的12种方法_第1张图片

压缩您的网站 (Compressing Your Site)

In simple terms, site compression is like turning your entire site into a ZIP archive. And when any of the pages of the site is requested for, a client’s browser acts like WinRAR and unzips the archive and then show the contents. Even though this sounds like an extra work and would slow things down, trust me, it doesn’t.

简而言之,站点压缩就像将整个站点转换为ZIP存档一样。 当请求该站点的任何页面时,客户端的浏览器的行为类似于WinRAR并解压缩归档文件,然后显示其内容。 即使这听起来像是一项额外的工作并且会使速度变慢,请相信我,但事实并非如此。

Even though W3 Total Cache is well known for caching, it can also be used in site compression. You can enable this feature by going to: admin page -> Performance -> Browser Cache -> Enable HTTP (gzip) Compression.

即使W3 Total Cache以缓存闻名,它也可以用于站点压缩。 您可以通过以下方法启用此功能: 管理页面 -> 性能 -> 浏览器缓存 -> 启用HTTP(gzip)压缩

优化数据库 (Optimizing Your Database)

WordPress often auto-saves almost everything. This includes: unwanted revisions, trackbacks, pingbacks, trashed items, unapproved comments, or comments marked as spam.

WordPress通常会自动保存几乎所有内容。 这包括:不需要的修订,引用,pingback,垃圾邮件,未经批准的评论或标记为垃圾邮件的评论。

Just as your hard drive can become fragmented, your WordPress database can also suffer from a similar problem. However, you can use the WP-Optimize plugin to optimize your database, or WP-DB Manager which enables you to optimize your database and as well as schedule dates for regular database optimization.

正如您的硬盘驱动器可能变得碎片化一样,您的WordPress数据库也可能遭受类似的问题。 但是,您可以使用WP-Optimize插件来优化数据库,也可以使用WP-DB Manager来使您优化数据库并安排定期进行数据库优化的日期。

选择正确的插件 (Choosing the Right Plugins)

Installing a lot of plugins can add a tremendous amount of junk to your site and site files. There’s no point in installing or keeping plugins you don’t really need.

安装许多插件会给您的站点和站点文件添加大量垃圾。 没有必要安装或保留您不需要的插件。

The best approach is to audit your WordPress Plugins, keeping the ones that are critical to the running of your site, and remove the ones that are not.

最好的方法是审核WordPress插件,保留对您的网站运行至关重要的插件,并删除不重要的插件。

禁用引用和引用 (Disabling Trackbacks and Pingbacks)

By default, every time another blog mentions you, your site gets be notified. These are called pingback and trackbacks. You can turn off this feature in WordPress here: admin page -> settings -> discussion, and uncheck the first two checkboxes as shown below.

默认情况下,每当另一个博客提到您时,就会通知您的网站。 这些称为pingback和Trackbacks 。 您可以在WordPress中关闭此功能: 管理页面 -> 设置 -> 讨论 ,然后取消选中前两个复选框,如下所示。

加快WordPress网站的12种方法_第2张图片

Turning this WordPress feature off won’t harm your site.

关闭此WordPress功能不会损害您的网站。

选择一个好的主题或主题框架 (Choosing a Good Theme or Theme Framework)

While some WordPress themes are extremely fast and well coded, some are the exact opposite.

虽然某些WordPress主题非常快速且编码良好,但有些却完全相反。

When choosing a theme, take note of the load speed of the theme’s demo page, this will give you an idea of the impact the theme would be adding to your site load speed.

选择主题时,请注意主题的演示页面的加载速度,这将使您了解主题将对您的网站加载速度产生的影响。

优化您的首页结构 (Optimizing the Structure of Your Homepage)

Showing post excerpts and minimizing the number of widgets and posts in a page is an excellet way to keep your homepage optimized.

显示帖子摘录并最大程度地减少页面中的小部件和帖子数量是使您的首页保持最佳状态的一种极好的方法。

Not only does this help your site load speed, it also improves your overall user experience. As I mentioned above, you only get one shot at making a first impression!

这不仅有助于提高网站加载速度,还可以改善整体用户体验。 正如我上面提到的,给人留下第一印象的只有一枪!

启用保持活动 (Enabling Keep-Alive)

HTTP Keep-Alive is the idea of using a single Transmission Control Protocol (TCP) connection to send and receive multiple HTTP requests, instead of opening new a connection for each request.

HTTP Keep-Alive是使用单个传输控制协议(TCP)连接发送和接收多个HTTP请求的想法,而不是为每个请求打开新的连接。

Your web host might already have these sorts of settings enabled so check with them first, but if you have a typical hosting account, you can copy the line of code below into your .htaccess file to enable keep-alive.

您的网络主机可能已经启用了这些类型的设置,因此请先进行检查,但是如果您有典型的主机帐户,则可以将下面的代码行复制到.htaccess文件中以启用保持活动状态。

Header set Connection keep-alive

Header set Connection keep-alive

结论 (Conclusion)

In this article I’ve covered twelve of the best approaches to help speed up your WordPress website. Effective implementation of these methods will greatly improve your WordPress site load speed. Web performance is a broad topic, if you’d like to read more on the subject, here are a few articles that you might find interesting.

在本文中,我介绍了十二种最佳方法来帮助加快WordPress网站的速度。 这些方法的有效实施将大大提高您的WordPress网站加载速度。 Web性能是一个广泛的主题,如果您想阅读更多有关该主题的内容,那么可能会发现一些有趣的文章。

  • Speeding Up Your WordPress Site

    加快您的WordPress网站

  • 10 Easy Ways To Speed Up Your WordPress Site

    加快WordPress网站速度的10种简便方法

  • Optimizing your WordPress Performance with P3

    使用P3优化WordPress性能

  • Speeding your WordPress Site With a CDN

    使用CDN加速您的WordPress网站

I look forward to hearing your WordPress performance tips in the comments below.

我期待在下面的评论中听到您的WordPress性能提示。

翻译自: https://www.sitepoint.com/12-ways-to-speed-up-your-wordpress-website/

你可能感兴趣的:(java,python,人工智能,数据库,大数据)