low-angle photography of metal structure

Publishing WordPress Sites without a PHP server

As I’m typing this up, I am watching the Boston Strangler movie on Netflix with my wife. I wanted to see how fast I could spin up a blog.

My requirements:

  • Must be simple
  • Must be fast
  • Can’t build it from scratch
  • Content must be served from my personal domain
  • Inexpensive solution
  • Secure

Even though it’s known for blogging, WordPress is a great CMS. Chances are, you’ve engaged with many websites that were built in WordPress. It’s a powerful tool. The dilemma is that I want to pay as little as possible to host the content. A web server with PHP and database server MySQL are required to run WordPress.

  • WordPress, PHP, and MySQL will require updates
  • MySQL requires maintenance
  • Bad actors will attempt to exploit web servers with PHP, WordPress, and MySQL

Even though server hosting has been commoditized these days, I’d prefer to not have these worries. Some of the top web hosting companies have had issues at scale. I don’t anticipate my content demanding too much from their infrastructure, but my neighbor might cause me issues. Not to mention security concerns that have to be maintained.

The solution

At one of the design agencies I worked, we consulted an enterprise that required running Content Management Systems behind a corporate network. All content would have to be compiled to static HTML pages before being published. This meant no live systems were allowed to execute PHP or have direct/indirect access to a database.

This site gave me step by step instructions for knocking this out:

https://dev.to/aws-builders/hosting-your-static-wordpress-site-on-aws-s3-4cib

In summary, it walks you through setting up a WordPress site on your local computer using Docker. You can make all of the content changes you want. Once you’re ready to publish- you utilize a plugin called Simply Static. This bundles up all of the content into text files and images. The content can be uploaded to your hosting provider of choice.

There are some trade-offs going this direction:

Cons

  • Some of the server-side capabilities will be lost once you have the static files from Simply Static (you give up built-in features like comments and search).
  • It’s more steps to publish content (content is not in real-time).
  • You have to be familiar with how to upload content to a web server or Content Delivery Network (CDN).

Pros

  • The required database to server will no longer be needed and simplifies your server needs.
  • It’s less expensive to host with a server provider.
  • It’s more secure.
  • It’s highly scalable without needing to tune servers and databases.

Notes & Observations

  • WordPress and Simply Static have issues when using localhost:8000. Instead, I have to connect to my host NAT IP.
  • The new version of WordPress is wildly different from the last version I used years ago.
  • Turning on Permalinks makes the URLs makes it easier to browser the files.
  • The dynamic features like comments will publish as though they work, but do not. I ended up removing search and comments from templates. Simply Static Pro has a solution if you need these.
  • I’m not seeing how the best SEO Plugins relying on networking site to site will work.
  • I had to remove search (will replace with Google) and add a comment (will replace with Facebook) from the pages.
  • Using Google’s Site Kit plugin for WordPress doesn’t work when running it local.

Nice to haves

  • Expanding on Simply Static to deploy to my own S3 Bucket (appears the pro has this feature)
  • Deleting old content from the S3 bucket between uploads

Cheers!


Posted

in

by