Table of Contents
1.选择一个好的主机
2.选择一个更快的主题
3.选择一个缓存插件
4.使用个CDN
7. 要注意及时更新你的主题和插件
8.优化数据库
9. 优化上传的图片
Home Backend Development PHP Tutorial 9条提议让你的WordPress网站更快运行如飞

9条提议让你的WordPress网站更快运行如飞

Jun 13, 2016 pm 12:27 PM
cache mysql wordpress

9条建议让你的WordPress网站更快运行如飞

1.选择一个好的主机

尽量不要使用免费主机或者共享主机(Godaddy啊、Bluehost啊等等所谓无限带宽、无限网站之类的主机)
首先,你的域名和你的主机最好在一个IDC哪儿,如果不是的话,建议你采用口碑良好的DNS服务商,让域名以最快的速度解析到主机上,这不是重点,重点是你的服务器/主机空间应该够快,怎么才能够快呢?CPU的配置、CPU的使用率、物理内存的大小、磁盘类型以及磁盘的I/O性能(包括Mysql数据库服务器所用磁盘)、Mysql响应速度以及Mysql并发数等等,都会影响到网站的快与不快,并且是物理性的影响。

2.选择一个更快的主题

什么样的主题才能更快呢?直观来看,包含尽量少的php、js、css和字体(字体或图标字体)文件的主题性能会好些。从代码来看,编码合理并在正确的页面载入正确的文件的主题会好些。

3.选择一个缓存插件

推荐使用 W3 Total Cache 或者 WP Super Cache ,都是免费的,但是都很好使,我个人更喜欢W3 Total Cache,因为它支持:页面缓存、HTML压缩、对象缓存、数据库缓存、客户端浏览器缓存、以及CDN。

4.使用个CDN

国外的话,CloudFlare不错;国内的话,加速乐不错。
5.启用Gzip
如果服务器支持,就启用Gzip,上述缓存插件W3 Total Cache就支持你启用这个。
6. 使用编码良好的插件
WordPress有着数不清的插件,但并非所有插件的代码都是编码良好的,这就需要你确定下哪些插件是适合你的了。最直观的办法是:当你从Wordpress插件目录安装一个3星以下的插件的时候,你应该仔细了解下它的代码情况了!怎么了解呢?

7. 要注意及时更新你的主题和插件

及时的更新自己所用的WordPress主题和插件,不仅能提高自己的Wordpress网站的安全性,而且有些更新是针对性能的,这样就会在性能上有所提升的。

8.优化数据库

你可以使用 WP-Optimize 或者 WP-DBManager 之类的插件来优化自己的数据库,这些插件能够删除那些未经审核的垃圾评论,那些回收站中的文章,那些自动保存的草稿或者文章的回滚版本等。当然了,最好的方式是你能自己访问你的数据库并执行SQL语句来进行这些操作,如果你觉得自己对SQL和Wordpress都够熟悉的话。

9. 优化上传的图片

对于任何一个网站来说,图片都是页面上比较重要的元素了,但是你的图的大小要与你使用这张图的最大的容器的尺寸相匹配,而不是原生态的P一张图或者一张照片就直接上传了。举个例子来说:你要上传一张图,这张图所在的最大容器宽度是948px,这张图本身的宽度是1600px,你应该处理下这张图,让它的最大宽度是948px就行,这样能显著提高该图所在网页的载入速度,缩短载入时间并节约服务器资源和带宽。
另外一种情况是:你上传的图的最大宽度和你所用改图的最大容器的宽度一致,这种情形下,建议你用Smush.it 以及基于它的Wordpress插件来处理一下上传的图片,当然了,你也可以使用类似于 无损图片压缩大师 之类的桌面软件(图片压缩软件推荐)或jpegmini 之类的在线网站来压缩你的图片。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1662
14
PHP Tutorial
1261
29
C# Tutorial
1234
24
How to adjust the wordpress article list How to adjust the wordpress article list Apr 20, 2025 am 10:48 AM

There are four ways to adjust the WordPress article list: use theme options, use plugins (such as Post Types Order, WP Post List, Boxy Stuff), use code (add settings in the functions.php file), or modify the WordPress database directly.

MySQL and phpMyAdmin: Core Features and Functions MySQL and phpMyAdmin: Core Features and Functions Apr 22, 2025 am 12:12 AM

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

How to build a website for wordpress host How to build a website for wordpress host Apr 20, 2025 am 11:12 AM

To build a website using WordPress hosting, you need to: select a reliable hosting provider. Buy a domain name. Set up a WordPress hosting account. Select a topic. Add pages and articles. Install the plug-in. Customize your website. Publish your website.

Explain the purpose of foreign keys in MySQL. Explain the purpose of foreign keys in MySQL. Apr 25, 2025 am 12:17 AM

In MySQL, the function of foreign keys is to establish the relationship between tables and ensure the consistency and integrity of the data. Foreign keys maintain the effectiveness of data through reference integrity checks and cascading operations. Pay attention to performance optimization and avoid common errors when using them.

Compare and contrast MySQL and MariaDB. Compare and contrast MySQL and MariaDB. Apr 26, 2025 am 12:08 AM

The main difference between MySQL and MariaDB is performance, functionality and license: 1. MySQL is developed by Oracle, and MariaDB is its fork. 2. MariaDB may perform better in high load environments. 3.MariaDB provides more storage engines and functions. 4.MySQL adopts a dual license, and MariaDB is completely open source. The existing infrastructure, performance requirements, functional requirements and license costs should be taken into account when choosing.

How to cancel the editing date of wordpress How to cancel the editing date of wordpress Apr 20, 2025 am 10:54 AM

WordPress editing dates can be canceled in three ways: 1. Install the Enable Post Date Disable plug-in; 2. Add code in the functions.php file; 3. Manually edit the post_modified column in the wp_posts table.

SQL vs. MySQL: Clarifying the Relationship Between the Two SQL vs. MySQL: Clarifying the Relationship Between the Two Apr 24, 2025 am 12:02 AM

SQL is a standard language for managing relational databases, while MySQL is a database management system that uses SQL. SQL defines ways to interact with a database, including CRUD operations, while MySQL implements the SQL standard and provides additional features such as stored procedures and triggers.

How to write a header of a wordpress How to write a header of a wordpress Apr 20, 2025 pm 12:09 PM

The steps to create a custom header in WordPress are as follows: Edit the theme file "header.php". Add your website name and description. Create a navigation menu. Add a search bar. Save changes and view your custom header.

See all articles