Let it be a shared hosting, cloud hosting, MySQL or whatever type of hosting that you are trying to go for, everything has similar principles that, once you understand those, make it really really easy for you to adapt to any setting.
What is hosting?
Simply put, as an entity, you use some amount of storage and computational resources to process files in such a way which can be accessible via the internet. So in some sense, hosting can be understood to be a machine which is accessible to everyone connected to an internet. You can verify this analogy by looking at the core functionalities of different types of hosting present in the modern times. We have shared servers, dedicated servers, Virtual Private Servers (VPS), Virtual Machines (VMs) and so many more. You can read up about these down below to gain more insights.
Shared Hosting
Shared hosting is when there is one server instance which harbours various other hosts simultaneously, allowing each host to act as a unit of the server. In simpler words, there is just one machine, but a lot of users which can simultaneously use that machine to show the files they want to show. Usually, small business and personal websites are hosted on these type of server settings but as a developer, one could experiment according to the use case.
A shared hosting essentially has certain limitations when it comes to hosting. Usually one can find that shared hosting servers are used to host PHP and MySQL with a few other basic configurations which can differ from one provider to another. All you have to do in such servers, is upload your files, configure the settings and it’s deployed. In most of the hosting plans, you can configure the following things:
- DNS records
- .htaccess
- php.ini (or any other PHP related configurations)
- MySQL server configurations
- FTP/SFTP
- SSH access (to some extent)
These are essentially all the things that you need to get started with ANYTHING related to hosting.
Dedicated Hosting / VPS
These type of hosting services are the ones where you own the machine completely and can utilise all its resources completely. It can be understood as a bigger and better version of a shared hosting simply because it allows you to control a lot of things and configure the server according to your own needs and not the shared needs of other users. These characteristics can prove to provide a lot more security as one can take responsibility of the whole machine, in contrast to the shared hosting where you are responsible only for the small amount of resources and space allocated to you.
Virtual Machines
Virtual Machines (VMs) are cloud based services where you are given a proper machine which exists virtually on a cloud. You can use this as a medium to host anything you want as most of these VMs utilise the Unix shell to run. You can host anything ranging from PHP, Laravel up to Node.js, Python and GoLang. The simplicity and security of these services gives them a preference over the well known methods and services of hosting. However, just like a VPS, the entity should ensure proper security and follow standard safety protocols in order to prevent any malicious activity from damaging the integrity of the server.
That’s cool. But how do I use it?
Just like you use your PC. As a developer, you ought to be using your laptop to develop and test your website / web application in a local environment, where you possibly create a quick server using one of the plugins in your IDE or using some CLI command which renders your .html
webpages, or if you are developing in another language like PHP, you ought to be using an Apache Tomcat server which allows you to render PHP code, or if you are a Node.js or Python developer who needs a runtime environment, you obviously install the necessary packages and binaries for these environments and package managers which handle everything for you and all that you have to do is enter the right set of commands. Either way, you have 2 things in common:
- You are using a machine to store the files
- You are using that machine to further render those files, mostly on a network (local)
That’s true. If you have a server instance running on your PC, while it’s connected to the local internet / WiFi, then the files that you are “hosting” on the server instance can be view not only via your laptop, but also via any device that is connected to the same network. Obviously the IP address has to be correct along with the ports (if any), but you are now hosting those files on your PC, over your local network.
Take the same logic to another computer, where you transfer these files and store them, and that computer is accessible to the entire internet. Now, that computer shall “serve” each request which can come from any network or WiFi connection or whatever, but it doesn’t change the fact that it’s only through this one computer, this one “server” which is doing the whole thing and not changing according to the other person’s network.
So you simply do this:
- You transfer the files onto the server using FTP, Git, or any other third-party platform / pipeline (GitHub, Heroku, etc.)
- You configure the server according to whatever you require to do with those files
- Make sure that the files are named and placed correctly as per the configurations
- Run the server
To practically understand this, one can possibly use one of the free services to host. I am providing a list of such service providers / platforms which can be used for educational purposes:
In case you find yourself still confused, write to me and I will probably be able to help you out better.