How to Host a Website on a Cloud VM From Scratch: a Beginner Walkthrough

Setting up a website on a cloud VM can be done in just an hour, even if you’ve never even seen a server.

A cloud VM is a rented virtual server with its own CPU, memory, and storage that is available for monthly payments. You install a web server, upload your files, and direct your domain to it.

This guide will use Ubuntu OS and Nginx server – the combination that is widely used and easy to operate. All commands are provided.

What do you need before you start?

You need four things, and most people already have two of them. Gather them first so the setup runs without pauses.

Check that you have:

  • A domain name, such as example.com
  • Your website files, even a single index.html will do
  • A cloud account with a payment method
  • A terminal for connecting to the server (Terminal on Mac and Linux, PowerShell on Windows)

How do you choose and create the VM?

Choose a small Linux plan and upgrade later. For the first website, 2 vCPUs and 8 GB RAM would suffice. The cost of such a general-purpose plan on CloudPe with the above specifications comes to ₹1,182 per month, where the storage cost is separate.

Choose Ubuntu LTS as your operating system. If there is any request during the setup process to use an SSH public key, then do that since it is more secure than password authentication. Launch the VM and take note of the public IP address.

Want a quick start? Create your first Linux virtual machine on CloudPe and follow along with the next steps.

How do you connect to the server?

Establish an SSH connection, which is a secure remote login. In your terminal, execute the following command by substituting your IP address for the placeholder:

ssh root@YOUR_SERVER_IP

Type yes when asked about the fingerprint. If you added an SSH key, you will land at the command prompt. You are now typing commands on the server itself.

How do you secure a new server?

Do three immediate actions: Update the operating system, create a regular user account, and enable the firewall. This will protect you from most of the basic threats.

apt update && apt upgrade -y

adduser deploy

usermod -aG sudo deploy

ufw allow OpenSSH

ufw allow ‘Nginx Full’

ufw enable

Keep your current session open, then open a second terminal and test the new login with ssh deploy@YOUR_SERVER_IP. If it works, you can use this account from now on.

How do you install a web server?

Install Nginx, which serves your pages to visitors. It takes one command:

sudo apt install nginx -y

Visit http://YOUR_SERVER_IP in your browser. You should see the Nginx welcome page. That means your VM is online and answering requests.

How do you upload your website files?

Copy your files into the folder Nginx serves, which is /var/www/html. First give your user permission, then upload from your own computer:

sudo chown -R deploy:deploy /var/www/html

scp -r ./my-site/* deploy@YOUR_SERVER_IP:/var/www/html/

Reload the page in your browser. Your own site should now replace the welcome page. If you use Git, you can clone your repository into the same folder instead.

Planning a larger site? See VM plans and pricing to compare memory, CPU, and storage options.

How do you point your domain to the server?

Add an A record in the DNS configuration of your domain. Make the host “@” and the value your IP address. Create another A record with the host “www” and the same IP value.

A change in DNS configuration may take a minute or two and sometimes can take more time. After it propagates, just type your domain in the browser to access your website.

How do you turn on HTTPS?

Use Certbot, which gets a free certificate and sets it up in Nginx. Install it and request a certificate for both names:

sudo apt install certbot python3-certbot-nginx -y

sudo certbot –nginx -d example.com -d www.example.com

Follow the prompts and choose the option that redirects HTTP to HTTPS. Certbot also sets up automatic renewal, so the certificate keeps refreshing on its own.

What should you do after your site goes live?

Develop a few good practices that will keep your website running smoothly as your traffic increases.

Some tips:

  • Take a backup or a snapshot before performing any major actions.
  • According to CloudPe, built-in backups and on-demand snapshots are available on its VM page.
  • Perform an apt update and apt upgrade a few times every month.
  • See how the site is running from both your mobile device and desktop computer.
  • Monitor your CPU usage and memory use as visits become higher.
  • Scale up the VM if you require more resources.

Ready to put this into practice? Deploy your first cloud VM and have your site online today.

Conclusion

To host a website on the cloud using a VM, create an Ubuntu server, log in to it via SSH, harden the server, install Nginx, upload your files, and configure the domain name and HTTPS. 

All these procedures will take no more than a few minutes and require just a few commands. Start with small packages and scale if necessary. Once you get the hang of it, creating the other one will be very easy.

Frequently Asked Questions

How much does hosting the site on a cloud VM cost?

The price depends on the plan size and storage. A small general-purpose plan with 2 vCPUs and 8 GB of RAM on CloudPe starts at ₹1,182 per month, plus storage. See the pricing page for exact prices.

Do I have to be familiar with Linux?

No. The commands provided above cover everything a beginner needs to do. They can be used as-is.

Can I install WordPress on the VM?

Yes. It requires adding PHP and the database, such as MySQL, along with Nginx. There are templates available on CloudPe with pre-configured stacks such as LAMP.

What will happen when my site outgrows the VM?

You can upgrade to a larger plan. CloudPe lists live resizing of CPU and memory without a reboot.

Disclaimer: The information in this article is for general informational purposes only and does not constitute professional, technical, or security advice. Cloud provider features, pricing, plans, and availability mentioned are based on provider information and may change without notice. Server configuration, security hardening, and backup practices should be adapted to your specific environment, and readers should follow their provider’s documentation and applicable security best practices. Commands are provided for guidance only; running them incorrectly can affect your server or data. Any mention of specific providers or services does not imply endorsement. The author and publisher disclaim any liability for decisions made based on this content.

Discover posts that make complex topics feel simple—our clear-thinking guides turn confusion into confidence.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *