Refer to this guide to learn how to create a Virtual Machine in Azure\ <https://scribehow.com/shared/Creating_your_first_Virtual_Machine_in_Azure__m7sJfxD7SKOuonRH8SNW2A> Refer to this guide to learn how to connect to a Virtual Machine and Run Commands<https://scribehow.com/shared/Connecting_to_Azure_Virtual_Machine_and_Running_Commands__DvsluSAeSQugjPfDBr0rrA>
Connect to the **my-first-vm** through Azure Cloud Shell
Type the command [[sudo su]]
**What is sudo su command?**\ \ `sudo su` is a command used in Unix-like systems to switch to the root user account with superuser privileges.
Type the command [[apt-get -y update]] **Note:** This command is used to update package index files to get the latest list of available packages in the repositories.
**Is updating needed before installing Nginx on the Azure VM?** Yes, updating is necessary to ensure that your system has the latest package information and can install or update packages correctly.
Type the command [[apt-get -y install nginx]] **Note:** This command will install Nginx on the Azure VM
**What is Nginx ?**\ \ Nginx is a popular open-source web server and reverse proxy server known for its high performance, stability, and scalability. It's commonly used to serve web content, handle incoming HTTP requests, and efficiently distribute traffic across multiple servers.
As the Nginx is installed on the VM, to view the webpage. go to the **my-first-vm** wizard, locate the **Public IP address** section and click on the copy widget
Open a new tab in browser and paste the **Public IP address**
**Welcome to nginx!** page will open **Note:** This welcome page indicates that the Nginx has now been installed on the Azure VM
Congratulations on successfully installing Nginx in Azure VM! Now, let's proceed to change the displayed text to "**hello world**". To do this, follow the steps outlined below.
Type the command [[echo "Hello World" > /var/www/html/index.html]]
**What does the echo command do?**\ \ The `echo` command is used to display text or variables in the terminal or command prompt.
On the **Welcome to nginx** wizard , on the top left corner click on the refresh widget
**Hello World** is displayed on the web page
To print the hostname with the text "Welcome to in28minutes", then type the command [[echo "Welcome to in28minutes $(hostname)" > /var/www/html/index.html]]
**What does the command** `echo "Welcome to in28minutes $(hostname)" > /var/www/html/index.html` **do?** The command writes a message to the file `/var/www/html/index.html`. It includes the text `"Welcome to in28minutes"` followed by the machine's hostname. The `$(hostname)` part dynamically inserts the current hostname of the machine. Any existing content in the file will be replaced with this new message.
Congratulations on completing this lab, Installing nginx on Azure Virtual Machine! Good Job!