Saturday, November 23, 2024
HomeEveryday WordPressDeploy a Static WordPress Site to Kinsta for Free

Deploy a Static WordPress Site to Kinsta for Free


WordPress is an excellent Content Management System (CMS). We can achieve almost anything with it. Because of its dynamic nature, we can change any content with a click of a button. And while this is amazing, it also brings some dangers, and it can get difficult to maintain under heavy traffic.

Converting your WordPress website into static might solve those problems.

What Are Static Websites?

To explain how static websites work, first, we have to understand how dynamic website works.

Every time we visit a website, the server has to parse PHP files, query the database to fetch the data, and, in the end, return the rendered HTML to the browser.

Static websites do all the heavy lifting first – before visiting the website, we save every page as static HTML. When we visit the desired page, the server serves it as it is.

The Pros of Going Static

Speed and Performance

Static websites are quick and performant. Why? Because they are just static HTML. This means the server must do only one thing – serve the website. It doesn’t have to parse anything or wait for data from the database.

Also, static websites are easier to host on CDNs (although Edge Cache works similarly), which places all the files as near you as possible.

Overall – static websites perform amazingly under heavy traffic.

Security

WordPress’ core is secure – it really is. But the plugins and themes – not always. Also, everyone can try to start guessing our login and password.

Overall, I like to compare WordPress with a house with many doors and windows. It’s up to us to choose the most secure ones, but still, if one door isn’t safe enough, a hacker can hack our website.

Converting your website to static removes most attack vectors. Because it’s just HTML, a hacker won’t be able to use vulnerable plugins or benefit from a weak password.

Peace of Mind

A typical WordPress setup consists of many moving parts – PHP and database servers, themes, or plugins – and every part can break. With static, we remove most of them. Our server becomes more straightforward as it only serves HTML and our content is spread worldwide thanks to CDN, which makes it DDoS-protected.

As a result, the probability that something will break is much smaller than usual.

The Cons of Converting to Static

Workarounds

We are used to things like searching the website, adding comments, or sending forms to work out of the box with WordPress. With static, it’s not that simple anymore. Because we converted everything to HTML, we lost those possibilities.

We have to use some 3rd party tools to add this functionality back.

Build process

We are used to the new content being available on our website after pressing the publish button. With the static approach, we must convert our website whenever we want to update it. So it can take a few minutes between pressing the button and having it available for everyone.

Preliminary Steps

Before we start, we must take care of some things.

1. Create a Git Repository

We use GitHub in this example, but you can use any other Git solution (like GitLab or BitBucket). Right now, just create an account (if you don’t have one already) and create an empty repository.

After this, we have to create a file in the repo; otherwise, we won’t be able to connect it to Kinsta.

Add a file to your repository.

2. Connect This Repository With Static Site Hosting

Go to MyKinsta, select static sites from the sidebar, and select Add Site.

Select the repository you created, and don’t forget to select “Automatic deployments on commit.”

Kinsta's UI showing a new static site being created from a GitHub repository and its main branch.
Kinsta Static Site Hosting setup.



Source link

RELATED ARTICLES
Continue to the category

LEAVE A REPLY

Please enter your comment!
Please enter your name here


Most Popular

Recent Comments