Setting up a VPS using Digital Ocean

Readers who have been working with PHP for any reasonably period of time will, no doubt, have already managed to set up a hosted server in the cloud using one of the many thousands of hosting providers. Many of these offer free hosting if you're happy for your website to have ads. They can be a bit un-reliable but when you're just getting started they're ideal as you don't really want to part with credit card numbers while you're just learning or playing around.

When you move into the world of Linux hosting it's almost impossible to find free hosting. I have seen very low spec VPS for as little as $2 per month but $5 is a typical entry-level cost. Many of the big hosting providers such as Amazon Web Services and Microsoft Azure have free offers for students. Most of these offers are based around a credit based system. So, for example, AWS currently offers $75 worth of free hosting. Microsoft has something similar. The difficulty here is that setting up a simple low-spec VM that might only use $5-$10 per month of credit is actually made quite difficult. There's a dizzying array of options most of which are way more high spec then would be required by someone starting out. It's very easy to set up a VM and burn through your credit allocation in six weeks only to find that if you want to keep your application alive you have to pay a fairly steep bill.

Digital Ocean's entry-level VPS currently offers 1GB of RAM and 25GB of storage for $5 per month. When you sign up for a Digital Ocean Account you are offered a default $40 per month plan but if you click the arrow you can find cheaper options.

You get to choose where your VPS will actually reside. I chose London.

Initially, it would seem that the only implication of this is that you will want to be physically closer to where the majority of your users reside, but there are other considerations. Where your data is physically stored will determine who regulates your information and what laws you must observe. Data stored in Europe will be subject to GDPR. Certain jurisdictions may be liable to transfer to the US Federal government due to "Safe Harbour" agreements.

This section is not in any way intended to be legal advice but I would encourage you to consider these issues and try and familiarise yourself with the laws and regulations as much as reasonably possible at this stage.

Once your VPS has been created take note of the IP address. This is the address of your server - we will use it throughout the rest of this section.

Next we will figure out how to login to the server.