Where to begin

This may be related to my previous post about Regaining Access to DigitalOcean Droplets, but I think I'll write up the whole experience, as there seems to be many different issues I encountered (almost randomly).

I stated in that post that I had to reformat my main PC and set up the SSH Keys again in order to access the droplets. But it turns out there was a lot more going on.

As all good developers should do, my websites are encrypted with an SSL certificate; it's just good and common practice nowadays, and with that, increase the security of the sites. This means reviews and editing the files permissions, and setting up the correct keys and passwords to gain access to the server.

SSL Certificates

There are numerous different providers out there to certify your site; some are free, some are paid, and some may even come from your hosting provider. But that's not what I'm getting into today.

What I'd like to tell you is to make sure that your site is pointing to the correct directory on your site.

It sounds simple, I know, but I was having issues with redirecting my site to the secure version, and it was a simple matter that my Apache2 config files were pointing to the wrong directory.
It was a quick fix, some tweaking in the config files to make sure every attempt to access the site went to the correct place.

Granted, if you're not one who plays around with the config files, you should be able to get support from your service provider (if not, feel free to get in touch and I'll see if I can point you in the right direction).

File Permissions

More often than not, my clients want "WordPress sites", and sometimes it requires working with other developers or hosting providers who may or may not have things set up correctly. This can be a nightmare at times.

After a lot of research, testing, and hair pulling, I think I've got the access permissions set up in a way which is secure and functional.

Ownership of the files

Most servers use www-data for the user and group for their sites. Let's assume this is the same for you.
Your "website" folder needs to have the owner and group set to www-data. This will allow your website to own these files and folders, to view and make editions (if you've allowed it).

You can limit www-data to view only, but then how could you upload files via a media library, for example.

Read/Write Permissions

Here comes the more infuriating part. The read/write permissions for files and folders.

Again, in your website's folder, I would recommend that the permissions are set to 755 for folders, and 644 for all files within the main site directory.

It would also be beneficial to "hide" any config files (the files that hold connection details) from the public. The www-data user will still be able to access them, but not some randomer whose stumbled across your site.

In Summary

This all came about because I wanted to make my site secure with a certificate. I never gave it much thought for myself, because I was just running a "portfolio site", but I wanted a way for people to communicate with me.

So I had a contact form, which quick became bombarded with spam, so enter in reCaptcha, then that needed to be on a secure site.
So I install a certificate, only to find it's not working, that I can't make changes, and what-not.

None of these were major issues, but all added up, it can cause a lot of work.

Also the fact that I couldn't use my IDE to access my server using the SSH Keys. I had to in-fact convert that key into a PPK file and use that!
It wasn't a huge problem, but an inconvenience because of a bug with PhpStorm.

Just some FYI there.

I'm pretty sure I'll find more bugs as time goes on; from new and old features alike, but hey, who said the life of a developer was boring?

Let me tell you a bit about hosting.
It should be easy.

Recently I was testing out a VPS (who I won't name because they don't deserve the advertising), and it has been the biggest regret of the past few months.
Not only was the service appalling, but they added a lot of hidden charges and extra costs, severely dwarfing their advertised pricing.

After weeks of battling them, trying to get the information to understand what's going on, I decided to just close my account with them and move on to a far better service.

What is "Hosting"

Hosting is essentially a computer which stores your website.  Just like your computer has all your files to view and use, that is what a server is; a public computer for people to view the files.
It just so happen that these files are used to make a website.

However, "hosting" comes in many flavours.

Dedicated Server

We might as well start with the big-boy in the room.

Buying a dedicated server is essentially buying a whole computer to run your services from.  It's as simple as that.

These machines are designed to pack some power, and to be used for dedicated purposes.  As discussed in my previous post, my home server is a dedicated server; one machine dedicated to doing a specific task.  You can run the server from home, from your office, or from a server farm/company, but the idea is that it is one machine controlled by you and to do whatever you want with.

It is yours.

Shared Hosting

Now, the flip side (and a far cheaper option) is shared hosting.

To put it simply, this is a dedicated server (or servers) where you share the resources with other people.

This type of hosting has multiple sites running from it; think like a computer with many users who use it all at the same time.  Resources are allocated to each user/site.

This is usually a very low cost hosting, providing you with a friendly control panel and support system, although vulnerabilities to one site or the server can mean that everyone's site can suddenly disappear.  However, what you can do is heavily restricted; certain apps or programs will never be possible.

If money is really tight, or you're just getting into the web-game, this would be a good option, but I much prefer the next.

VPS

VPS, or Virtual Private Server, is a nice combination of Dedicated and Shared.  It is still one machine, but each user is given resources that are specifically theirs.  The main server creates little mini-servers inside of it, which are essentially their own standalone machine.  This keeps the cost down for running a server (because there are not thousands of tiny computers running web services).

But it essentially is just that.  You could buy several small lightweight computers to run a different site off each, but you'll need many cables .
The easiest thing is to get one powerful machine and split it up into smaller machines; similar to what I attempted with Docker; I should really have another crack at that.

This is essentially what I offer my clients, as I know what a pain it can be to share resources, and the costs of running a "basic site" is not much more expensive than with Shared Hosting.
Plus, who doesn't like having their own unrestricted server.

Cloud Hosting

Okay... now... hmm...

Cloud hosting is a series of dedicated machines, which create a massive hosting platform.

Think of all your office computers linked up to one another to create one super computer.  This is what Cloud Hosting is, to an extent.

Hosting from here can vary, but essentially provides you with a VPS which is scalable, so if you need more space, memory, or speed, the hosting scales it up to suit your requirements.

You're probably thinking this is the best option, right?  Well, it kinda is, having the resources there to meet your requirements, and not having to worry about running out of space, or whatever, except this comes at a heavy cost.

From my experience, Cloud Hosting is one of the most expensive options, due to the nature of it; resources are at a premium, because who knows when they'll be gone; plus think of the cost just to run all those machines, and keep them maintained.

However, the redundancy is top quality here, as if the server your site is currently on fails, it automatically switches to a new one, without having to worry.
With all our other options, if the server goes offline, your site goes offline (although that is becoming less common as technology progresses).

So, what should you choose?

Personally, I will always choose a VPS or a Dedicated Server, depending on your requirements.  Most sites I manage I used a VPS for, with a few large, more resource-heavy sites using a dedicated server or two.

You can also choose to manage your server yourself, or find someone *cough* to manage it for you.

Generally you can find help and support from your host, and once everything is ready, it's generally straight forward; just hope you don't break something, like I've had clients in the past do before.

If you want to talk to me about hosting options, do feel free to drop me an email and we can discuss your requirements.
We can find the right plan for you, and get you online in next to no time.

Oh, it'd help if I left you my email: niall@classicniall.co.uk

Classic Niall Limited © 2022

Contact Us

Classic Niall Limited
The Wesley Centre, Blyth Road
Maltby, Rotherham
S66 8JD
hello@classicniall.co.uk
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram