This is a practical tutorial featuring complete steps on how to set up a Linux server (VPS/Cloud) to host your websites. All articles related to this guide are done for newbies. Easiness to follow is the main concept of this tutorial (and so this blog).
This article serves as the starting page for newbies. Based on my personal experience, newbies are confused about which to start and what’s next to do.
That said, I’ve chosen the easiest route for newbies to get their own hosting servers up and running for production. We don’t include some manual installation methods despite challenging. We’ll cover that in the future once all parts of this article are done.
The Starting Point
I assume the starting point to follow this guide is the condition without knowledge of Linux VPS/Cloud at all. Hence, please don’t be shy and don’t be hesitant to ask, even for a tiny bit of steps you don’t understand.
Both you and I are still learning. let’s learn together. Remind me if I did something wrong in the article.
How to Set Up a Server to Host Websites
Follow all parts of this sequence. Feel free to jump into the part that you are interested in the most. Skip any part(s) you already knew.
1. Grab A Linux Server (VPS/Cloud)
First, you’ll need a working Linux server to host your website of course. There are many options available. In general, there are three popular virtualization technologies available: OpenVZ, KVM, and Xen. Of course, there are some others including OnApp but the three mentioned are the most popular.
Cloud servers usually employ KVM virtualization including Digital Ocean, Vultr, Linode, etc.
Buy one based on your own preferences including plan, price, type of virtualization, performance, and users’ reviews.
Need a recommendation? Check out our list of recommended VPS providers or our dedicated Review section.
2. Download Essential Tools
Now you have purchased a virtual private server (VPS) or deployed a cloud instance. What’s next? You’ll need to download (and install) all the essential tools.
What are they?
- Download PuTTY: a client program for the SSH, Telnet and Rlogin network protocols.
- Download WinSCP: a popular SFTP client and FTP client for Microsoft Windows.
- Advanced code editor: needed to edit your website’s code locally. Recommended text editor: Visual Studio Code (VSCode), Sublime 3, Atom, and Notepad++. Personally, I prefer VSCode or Sublime 3.
3. Learn Basic Linux Commands
You don’t have to master all Linux commands. You just need to know a few of the basic ones such as how to change directory, to list files and folders, to copy files, to delete files/folders, and to edit a file directly.
4. Do The Basic Server Setup
There are some initial steps to do as a common practice to secure a newly deployed server, either a VPS or a Cloud. This including a password change and limiting access for the root user.
5. Install Webserver, Database Server, and PHP
You’ll need a stack of software to build a web hosting server. The stack should consist of at least the web server, database server, and PHP processor. In practice, you’ll need more than those for a production server. For instance, you’ll also need a firewall, a DNS server, a caching software, and so on.
Traditionally, you have to install all the required software one by one. Luckily, we’ll focus more on the end result and hence we can make use of several pre-built stacks either LAMP, LNMP/LEMP. Some of these ready-to-use stacks come with a web hosting control panel. You may or may not need the panel but its existence will help you a lot.
There are many to choose from. We’ll start with the most recommended one at the beginning of the list.
- CentOS Web Panel
- Centmin Mod
6. Upload All Website Assets
Now your hosting server is ready. You just need to upload the files and folders of your website(s) to your server.
Read How to Upload and Edit Files from Computer to Server
7. Pointing Domain Name to The Server
Your server is ready and all assets of your website have been uploaded. What’s next? You have to point your domain to your server so that people can access it through the Internet.
There are two options:
- Use third-party DNS hosting (easier, faster).
- Install and use your own DNS server (looks cool, you can brag about it).
Read List of Free and Best DNS Server Providers.
8. Install SSL Certificate
Once the domain name has been propagated, you can now set up an SSL for your website. You can use either Let’s Encrypt SSL Certificates or use paid SSL from services like Comodo, DigiCert, GeoTrust, GlobalSign, etc.
Issuing SSL depends on which server stack you use, LEMP or LAMP. Moreover, hosting panels and webserver installers (Point 5) have an SSL issuance feature to further ease the process.
Building a working and fast hosting server is easy. Driving huge traffics is not the easy part. You have to make friends with Google.
That’s all that you need to build a web hosting server. There many other tutorials beyond the basic ones above. However, the list above contains the most essential steps to set up a server by yourself (Do It Yourself / DIY).