Skip to main content

Command Palette

Search for a command to run...

Host a Simple Website on a VM

Install a web server and host a static website.

Published
1 min read
  1. Login to your google cloud account.

  2. Go to Compute Engine

  3. Click create instance.

  4. Name the instance and select region.

  5. Click on create.

  6. Here, we will create a VM instance and make sure to Allow HTTP and HTTPS traffic under Firewall and leave other settings as default.

  7. Now, SSH into it and install apache and commands for that are listed below

    • sudo su

    • apt update

    • apt -y install apache2

  8. apache is installed

  9. Close this SSH, and copy your External IP and paste it into the browser

  10. You will be able to see apache2 page that means your apache is successfully installed

  11. Now, open your ssh

    • enter the command sudo nano /var/www/html/index.html

    • Here, we can make changes to the index file and same will reflect in the web-page

    • For ex. I’m making changes in title

      We can clearly see, title got changed.

    • In the same way we can make changes to the file also.

Congratulations! You've successfully hosted a simple website on your VM. Keep experimenting and building your cloud expertise!

GCP VM Series: From Zero to Compute

Part 9 of 14

Get ready for an exciting ride in Google Cloud! Our series takes you through every method of creating virtual machines in GCP, complete with engaging tutorials and practical labs. Elevate your cloud game and become a VM virtuoso!

Up next

Setting Up Firewall Rules

Configure firewall rules to control traffic to/from VM instances