Managing your own website hosting

Managing your own website hosting
Photo by Sammyayot254 / Unsplash

When it comes to running a website, there's a couple of obvious ways to go; shared hosting, or self hosting. Managed hosting is where your website sits on the same physical server as other websites, and they all share the resources of that server. I'll cover that more in another post.

Self hosting is where you either have a dedicated server, or you have a virtual private server (VPS) which gives you specifically allocated resource to use for your website. I'll refer to either of these options as "self-hosting" throughout this article.

With this dedicated/VPS route there will be providers out there who can, for a fee, manage the servers for you and provide support. The fees for this can often be the same, or more, than the cost of the hosting itself. It might be worth it for your needs, but remember to factor that into the cost analysis if you do.

If you don't want to pay for someone to manage the server for you, then be aware it will be your responsibility to:

  1. Install all the software you need on the server
  2. Keep the server up-to-date (all software and operating system patches)
  3. Perform backups of all data and configuration in case something goes wrong

That fairly small list is just the potential tip of the iceberg, so why would you even want to consider this route?

Why should you self-host?

1. Performance

As mentioned above, going down the self-hosted route gives you specific resources for a machine. If you have a dedicated server, then all the resource on that machine is all yours. Servers tend to have a good amount of power in them. I'm talking 6-core/12-thread machines with 32GB RAM all for you to use yourself, and only £55 per month.

If you choose a VPS, then you'll have a set number of cores (vCPU) and set amount of RAM and disk space. That's allocated on a server (or group of servers) which other machines are on.

This means that if someone is running some intensive workloads for their site, it's not going to affect you - usually (I'll come back to this). On shared hosting, there is every possibility that the resource of the server you are also on gets allocated to some resource intensive process of another site. That can slow you right down.

Back to that "usually" point of you not being affected...Some of the budget offerings, or entry level offerings of some major hosts build their cheapest offerings in a way that they share server resource. If one VPS uses a lot of resource and "bursts" to use more for a time, it might actually use the CPU or RAM you have for your server. For instancce, DigitalOcean Basic plans are shared CPU resources (others plans are dedicated resources for your instance).

2. The Challenge (and learning)

There's a lot to learn when setting up a server. From choosing the right operating system for you, all the way to troubleshooting odd issues. There's finding the right combination of software to perform the task you want/need it to, as well as all the fun configuration stuff there too.

Firewalls. That's one which is a challenge, but necessary. They help secure your server to help prevent miscreants from getting access.

SSH keys. Disabling root access. Disabling user account passwords for login. Enabling intrusion detection. File system permissions. All kinds of things to learn, understand, and get frustrated at.

Then, just when things are all working brilliantly, you'll have an idea. Let's look for a cheaper server. New operating system. Move hosts. Split the database to a new server. Something.

It's a whole cycle of trying, failing, learning, succeeding, and then repeat. It's great!

Once you've done that a few times and gotten bored of the "easy" initial configuration, you'll want to learn about automation, or configuration as code (something like Ansible, Puppet, or Chef). More trying, failing learning.

Honestly - this is the best part!

3. Test Environments

Okay, the last point started serious and went a bit off the rails. But there is a lot to learn. There's also a lot of maintenance which needs to happen with websites. Not just at the server level, but with your actual site. Is it WordPress, Ghost, or another blogging platform? Is it a PrestaShop, OpenCart, Drupal Commerce web shop?

It doesn't matter - these all have updated. Even if the platform hasn't had an update, one or more of the plugins or themes you might have likely will. And these should never be blindly installed without some testing. Many a site has broken in the past due to plugin conflicts or incompatibilities.

To help avoid this, you'll want a test environment. That way, you can apply the changes to a test environment and check to see if it works. If it does, great - apply it to your live site (after taking a backup!). If not you can investigate why and fix it, or restore the test site and wait for the next update.

This is something you likely aren't going to get with shared hosting. Unless you pay for a second site. Some shared plans will allow multiple sites under your account, but that's only one part of the picture.

4. Control

Multiple sites in a shared hosting account might work for testing if updates to your site work. They might not give you control over when to apply the changes. Shared web hosts have a duty of care to the other customers on their server, so they may force updates to platforms at a time which doesn't work for you. Not only that, but they choose when operating system or other software updates get applied.

If you self-host, you have control as to what gets updated and when. You can try updating your server to the latest version of software (in your test environment), and if all goes well then update the live server. You did get a different test and live server, didn't you?

5. Scale

You've gotten to a point where your website is doing well, but everything is running on one server and it's just not enough. What can you do?

If you're on a shared platform, you can hope that upgrading brings you added benefits of performance. It probably won't. You'll just have a higher number of sites you can run, or disk space you can take up.

Self-hosting means you can move the database off to a server on its own, leaving your original server to still handle traffic. You can then add a second or third web server and put them behind a load balancer. This might need some discussion with your hosts, as you might need to migrate platforms with them to do this. Not many of them advertise services such as load balaners for their dedicated servers; most of them want you to go down their "cloud" route where it's all VPS linked to services like load balancers, firewalls, internal networks.

More things to learn.

What about the down sides?

There's a lot of good reasons to host by yourself. But why might it not be right for you?

1. Cost

Dedicated servers can be expensive for a small site. Over the years I've paid as little as $5 per month for a VPS, and as much as £60 per month for a dedicated server. I'm aware that's mixed currencies - it is intentional. Both sides of that would still be cheap today.

The VPS was on DigitalOcean, and is a shared resource VPS. To jump to a dedicated resource VPS, it would be $42 per month for 4GB RAM and 2 vCPU. That's not a lot of resource for the money (there are better prices out there), but it's also not far off the cost of a dedicated server with some hosts.

2. Time

Maintaining a server can be time consuming. Performing backups, testing backups, checking for updates, installing updates etc. It all takes time. If something goes wrong, fixing it takes time. Learning how to do something new takes time.

This is time you could be spending creating content for your site. Marketing your products. Packing and shipping orders. Working on new products or relationships with suppliers.

Is maintaining a server really something you want to do and have the resource for? Only you can answer that.

Should you self-host?

Ultimately that is your call. I've swapped between the two over the years and enjoyed both sides. I enjoy the playing, learning, and self-development of self-hosting. I also enjoy the additional free-time when I don't have to do the maintenance.

I think if my site ever got to a size where I needed significant performance benefits, then I would jump back to self-hosted and self-managed in an instant. I'm not there yet (and Ghost is really fast anyway), but I still think about it from time-to-time.

I'm currently considering going back down the self-hosted route as I write this, but I know that if I want to just get content together and out there, then a manages service is right for me. At least, it is right now.

Your circumstances may differ. Your needs may differ. It's all about being honest with yourself about your needs, desires, and resource.

I almost always had more fun when self-hosting than using a shared, managed platform. So there's that to consider...