Installing nginx on Azure Virtual Machine | Scribe

    Installing nginx on Azure Virtual Machine

    • Hafeez Baig |
    • 10 steps |
    • 35 seconds
    information ordinal icon
    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>
    1
    Connect to the **my-first-vm** through Azure Cloud Shell
    2
    Type the command [[sudo su]]
    information ordinal icon
    **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.
    3
    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.
    information ordinal icon
    **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.
    4
    Type the command [[apt-get -y install nginx]] **Note:** This command will install Nginx on the Azure VM
    information ordinal icon
    **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.
    5
    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
    6
    Open a new tab in browser and paste the **Public IP address**
    7
    **Welcome to nginx!** page will open **Note:** This welcome page indicates that the Nginx has now been installed on the Azure VM
    information ordinal icon
    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.
    8
    Type the command [[echo "Hello World" &gt; /var/www/html/index.html]]
    information ordinal icon
    **What does the echo command do?**\ \ The `echo` command is used to display text or variables in the terminal or command prompt.
    9
    On the **Welcome to nginx** wizard , on the top left corner click on the refresh widget
    10
    **Hello World** is displayed on the web page
    information ordinal icon
    To print the hostname with the text "Welcome to in28minutes", then type the command [[echo "Welcome to in28minutes $(hostname)" &gt; /var/www/html/index.html]]
    information ordinal icon
    **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.
    information ordinal icon
    Congratulations on completing this lab, Installing nginx on Azure Virtual Machine! Good Job!