Static WordPress

How To Make WordPress Faster And More Secure?

Maciek Palmowski

Maciek Palmowski

email maciek.palmowski@buddy.works

I work at Buddy

wordpress.org profiles.wordpress.org/palmiak

WordPress

Static

One big difference

  • WordPress avg response time - 2844 ms
  • Static avg response time - 16 ms

Static vs dynamic websites

Pros of converting to static

Speed

  • No database
  • No parsing, server only serves data
  • Easier server setup

Speed

5 clients every second for 30 seconds

WordPress without Cache - 2844 ms avg response

WordPress with Cache - 345 ms avg response

Static WordPress - 16 ms avg response

Speed

50 clients every second for 30 seconds

WordPress without Cache - error
100% error rate

WordPress with Cache - 600 ms avg response
29,6% error rate

Static WordPress - 12 ms avg response

Security

  • WordPress can be on a separate server
  • WordPress can even be available only on localhost

Attack vectors

Hosting Costs

  • Simpler hosting costs less
  • Sometimes it's free - GitHub Pages or Netlify
  • Typical WordPress hosting starts at 12 - 20 € / month / site

Peace of mind

  • There are less things that can break
  • Using a CDN can make your website equaly fast all over the world and protected from DDoS
  • The site will just work

Cons of converting to static

Not every site can be converted

  • User profiles
  • Dynamic content
  • Social media sites

Some parts will need some workarounds

  • Forms - Kwes, Basin
  • Search - Algolia
  • Comments - Reply Box, Disqus
  • ECommerce - Snipcar, Commercelayer

The build process itself

  • You always have to remember about it
  • It takes some extra time

Too long build time in some cases

  • Buildes take more time when there is a lot of posts
  • It will increase with every new post

Ways to go static

WordPress plugin + CI/CD

  • ✔️ It's cheap
  • ✔️ Full control over the whole proccess
  • ✔️/ ❌ Many plugins are compatible out of the box

Static Site Generator + CI/CD

  • ✔️ It’s cheap
  • ✔️ We can use other programming languages
  • ❌ More problematic in terms of plugins compatibility

Service

  • ❌ It's more expensive
  • ❌ Less control over the proccess
  • ✔️ It just works, without any setup
  • ✔️ Some additional plugin integations out of the box

Is it worth it?

Is it worth it?

Go for it when:

  • you don't have any login or registration feature
  • it's a blog, business page or portfolio
  • you aren't focused on adding a new post every few seconds

Real life example

Server Structure

  • One server with SSH access
  • WordPress is under a subdomain
  • Static is under top level domain
  • I'm using CloudFlare

WP2Static configuration

  • Excluding URLs I don't need (/category for example)
  • Excluding wp-content/uploads folder

Build times

  • ~200 pages takes about 1-2 minutes

Any questions?

  • Reach me out on Twitter - @palmiak_fp
  • Send me an email - maciek.palmowski@buddy.works

Thank you