HALF PRICE!
Udemy
course when you register on learnphalcon
The examples on this site are currently tested to work on Phalcon V3.4 and Phalcon Devtools V3.2 Some issues may arise when using later versions.

Please get in touch or post a comment below the post if you encounter a problem.

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.


To login to your server you will need a terminal emulator which supports Secure SHell access(ssh). Secure shell access, much like https, allows for an encrypted tunnel of communication between your desktop and the server for the purpose of access the Command Line Interface of your server. The CLI on Unix Operating systems is referred to as the "shell".

There are a number of terminal emulators available which support ssh but the most commonly used is putty. You can download and install putty from here https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

The 'root' account on Unix based operating systems has a special significance. The root user is a super user with privileges to perform any function. Given this power, the root account is guarded carefully and typically only one or two people might know the password. On a production server it is very usual for anyone to ever login as root. Instead administrators login using their own named accounts and when they need to execute a command which requires root privileges they preface the command with the word 'sudo'. This means that the command will be executed from the super user account (root). Some VPS systems may not allow anyone to login as root for this reason all the commands in the subsequent steps in the guide are prefaced with the command 'sudo'. Digital Ocean does allow root access so the commands will work with or without the 'sudo' prefix.

As stated, in an up and running production system it's good practice not to login as root. Given the fact that our server is brand new and pretty much everything we want to do requires root access logging in as root is practical. As we go forward you will learn how to create other accounts.

To connect to your server using putty insert the IP Address of your server into the field marked Host Name (or IP Address) and click connect as follows:

The password for your root account was sent to you in an email when you set up your VPS. Use it now to login as root. You will probably be prompted to change your password. If you are, be sure to use a strong password (i.e. At least 1 upper case, 1 lower case, 1 special character and at least 8 characters overall).

The first time you login you will get the following message

You will then be prompted for your username and password - use root and the password sent to you.

If successful you will see a screen like this

This is the Ubuntu command prompt which defaults to using bash (one of the more popular shell programs. On Unix there is a range of shell options. This is the command line interface which we will use for the remainder of this section. There are many guides and books available on using the shell and shell programming. Perhaps wait until your system is at least a bit more secure before wandering off to explore.

In the following step I will show you how to secure access to the root account using public/private key encryption. This is a very necessary step to prevent your server from being hacked. The need to keep your server secure now that you are a System Administrator cannot be overstated.