WordPress is the most popular CMS used by many websites; it is written in PHP which makes it an ideal choice for most people. It offers a lot of features and an easy to use backend.
But it performs well until the MySQL database is small and your WordPress setup does not live on too many plugins and has permalinks set correctly.
WordPress on a small Web Server cannot handle many visitors and might fail due to MySQL database crashing which at time can be a big problem, it can occur due to lack of free memory, if there are other things that use the MySQL database it will make WordPress slow if the website get a lot of traffic.
So, I decided to write a simple post, which will let you run WordPress on a small Web Server with optimum performance.
It is recommended that you do this in a clean WordPress setup and then migrate content to the newer install rather than tweaking the current WordPress install that is running in production, It is also better to test the environment before switching it to production, because there are many factors that can make a positive or negative performance difference.
Let’s do it!
We will use SQLite instead of MySQL, this is recommended if the website is just a blog or does not serve or receive thousands of requests at a time, I have not tested this in high traffic, but has been rock solid stable on the amount of views I get for my website.
You can follow this guide to install and setup WordPress with Sqlite.
You can use WP Super Cache plugin and cache WordPress, so it does not have to query the database on every request, it is recommended that you set WP Super Cache only to update when a new comment is made or when new post or page is updated.
If you are running NGINX instead of using WP Super Cache you can use the build in micro-caching of NGINX also known as Fast CGI cache which will cache WordPress for a fixed amount of time, this will cache the page on the first page request and will display stale content until timeout, this can do a big performance difference and can save you a great amount of system resource because it does not query the database on every request
I have written a NGINX config that can be used as an example while configuring your WordPress with NGINX setup.
I would also recommend to keep your WordPress install as clean as possible, don’t keep plugins that you don’t require, avoid plugins that are no longer being maintained and try to use a theme or write a theme that does most of the thing with the power of PHP templating.
Thanks for reading,
Have a question? Leave a comment below.