My WordPress Settings


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

ServiceImage
Proxycustom-built caddy server. Caddy can automatically obtain SSL certificates, provide HTTP/2 and many more features than NGINX and Apache.
Databasemariadb. Believe it or not, MariaDB is faster than MySQL on my server.
WordPresswordpress

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

PluginReason
AutoptimizeTried a lot, only this one can provide the best optimization performance for my case. Many others even slow down the loading speed
Code SnippetsAdd PHP code snippets without changing PHP files.
Disable CommentsSometime I need silence.
EWWW Image OptimizerImage optimizer and webp converter.
LuckyWP Table of ContentsThe best table of contents plugin I can find. No stupid JQuery, no stupid premium, no stupid CSS. FREE!!!
PolylangMultilingual
PrismaticSyntax hightlighter, even though sometime it is not working as you can see above 😔
Remove jQuery MigrateGET OUT OF MY SITE.
Simple Local AvatarsNo third-party Gravatar.
SmartCrawlSEO
Two FactorSECURITY, SECURITY, SECURITY.
WP StatisticsNo 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.

Published
Categorized as Server

By halyul

Never be a dreamer.

Leave a comment

Your email address will not be published. Required fields are marked *