DEV Community

Cover image for From Scratch to Server: Deploying a Linux Virtual Machine with Nginx on Azure
Precious Oladele
Precious Oladele

Posted on

From Scratch to Server: Deploying a Linux Virtual Machine with Nginx on Azure

INTRODUCTION

A virtual machine is like a computer inside a computer. It is a computer that is based on software and has its own operating system and applications.

NGINX is a reverse proxy and web server that is dependable and quick. It serves as a mediator between users and backend systems, distributes traffic among servers, and delivers web pages. It is frequently used to power websites and applications since it is efficient and versatile.

Getting Started: log in to your Azure account. and In the "Search resources, services and docs" field, type “virtual machines”. From the list of search results, click on the “Virtual machine” option.
virtual machin

  • Click the “Create” button to start the virtual machine creation process create
  • Select the appropriate subscription and create a resource group by clicking the create resource group button and giving it a name ant
  • Enter the VM details, including its name, operating system, size, and configuration settings. details
  • Create an Administrator Account. We need a username and a password in case we need to connect to the Virtual Machine. paaword
  • Locate the "Inbound ports" section. Ensure the checkbox for "HTTP (80)" is selected. This allows external communication with your web server. inbound
  • Click “Next” till we get to boot diagnostics in the Monitoring tab, and click on “disable”. disable
  • click on the tag tab, this is to identify the billing accounts tag
  • Carefully review all your configuration choices. Once satisfied, click "Review + create" followed by "Create" to initiate the VM deployment process. The portal will display the deployment progress. create
  • wait for deployment to complete. it might take a while deploymwnr
  • Once deployment is complete, navigate to your VM resource and click "Go to resource. resource
  • first thing to do here is to click on the public Ip address Ip add
  • Move the slider to the maximum, this is to increase the timeout and click on save when done. timer
  • Open a command-line interface (CLI) tool like Windows PowerShell or ubuntu terminal. Use the following SSH command, replacing the bracketed placeholders with your actual credentials: ssh [username]@[public_ip_address]
  • When prompted, confirm that you want to connect by typing "yes" and press Enter.
  • Enter in the password you created for the user and press enter

instruction

Update and Install Nginx

  • Switch to the root user with sudo su.

sudo su

  • Update your package lists with apt update and install Nginx using apt install nginx update

doen

  • Open a web browser and enter the public IP address you obtained earlier. If Nginx is running correctly, you should see a default welcome page. lastly Congratulations! You have successfully created a Linux virtual machine on Microsoft Azure and installed the Nginx web server. This is a foundational step for hosting web applications or deploying other web services.

Top comments (0)