This page shows details of my WordPress setup in order to get perfect performance.
For security reasons, some settings/plugins will not be disclosed.
Server
My servers are fully dockerized, so your deployment case may vary.
CDN
A long-term Cloudflare customer.
Docker Images
Service | Image |
---|---|
Proxy | custom-built caddy server. Caddy can automatically obtain SSL certificates, provide HTTP/2 and many more features than NGINX and Apache. |
Database | mariadb. Believe it or not, MariaDB is faster than MySQL on my server. |
WordPress | wordpress |
Caddy Configuration
:443 {
... # some private config
... # proxy settings
# Remove unnecessary headers
header {
-X-Powered-By
... # some private config
}
# Rewrite images to webp
@acceptsWebp {
header Accept *image/webp*
path_regexp webp ^(.+)\.(jpg|jpeg|png)$
}
handle @acceptsWebp {
try_files {re.webp.1}.{re.webp.2}.webp {re.webp.1}.{re.webp.2}
}
# Bloack some accesses
@forbidden {
path /xmlrpc.php
path *.sql
... # some private config
}
respond @forbidden 404
}
PHP Rewrite
This upload.ini
removes the PHP upload settings defined in the image, which is annoying.
Map location: upload.ini:/usr/local/etc/php/conf.d/uploads.ini
file_uploads = On
memory_limit = ???M
upload_max_filesize = ???M
post_max_size = ???M
max_execution_time = ???
WordPress Plugins
Plugin | Reason |
---|---|
Autoptimize | Tried a lot, only this one can provide the best optimization performance for my case. Many others even slow down the loading speed |
Code Snippets | Add PHP code snippets without changing PHP files. |
Disable Comments | Sometime I need silence. |
EWWW Image Optimizer | Image optimizer and webp converter. |
LuckyWP Table of Contents | The best table of contents plugin I can find. No stupid JQuery, no stupid premium, no stupid CSS. FREE!!! |
Polylang | Multilingual |
Prismatic | Syntax hightlighter, even though sometime it is not working as you can see above đ |
Remove jQuery Migrate | GET OUT OF MY SITE. |
Simple Local Avatars | No third-party Gravatar. |
SmartCrawl | SEO |
Two Factor | SECURITY, SECURITY, SECURITY. |
WP Statistics | No Google Analytics. |
Conclusion
With all these optimizations, this post page and the index page get both A on GTmetrix. Details can be found here and here.