Introduction
Setting up a web server is one of the foundational skills for anyone beginning their cloud, DevOps, or Linux journey. In this guide, you’ll learn how to securely connect to a Linux virtual machine (VM) using SSH and install Nginx, one of the most popular open-source web servers in the world.
Whether you're hosting a simple website, testing a deployment, or preparing for a DevOps role, this hands-on exercise will help you understand real-world server setup and management.
Create a Web Server VM in Azure
In the previous post, we dealt extensively with creating a virtual machine. So I will just list the steps below:
- Sign in to the Azure Portal
- Navigate to Virtual Machines → Create
- Select: Image: Linux image (e.g. Ubuntu Server .......)
- Size: Standard B1s or higher
- Authentication type: Password or Azure AD login
- In the Networking tab: Ensure RDP port 3389 is open for remote access
- Click Review + Create, then Create
Next, follow these steps to connect to a Linux server via SSH and install Nginx using the package manager.
Connect to the Linux VM Using SSH
- Use SSH to access your Linux server securely: on PowerShell,
Run the command: ssh username@hostname_or_ip
🔹 username → The account you want to log in with.
🔹 hostname_or_ip → The IP address or domain name of the VM.
Example:
ssh azureuser@192.168.1.100
- After running this command, enter the password when prompted. Note that the password will not physically show while you are typing it.
Switch to Root User
Ensure you have root privileges by switching to the root user:
On PowerShell, run this command: sudo su
You now have full administrative access to the server. This allows you to install software without permission issues.
Install Nginx
Use the package manager to install Nginx: apt install nginx -y
🔹 apt → The package manager for Ubuntu/Debian-based systems.
🔹 install → The action to install a package.
🔹 nginx → The software package to install.
🔹 -y → Automatically confirms the installation without prompting.
This command:
- Updates package lists
- Installs Nginx
- Automatically confirms prompts (-y)
Verify Nginx Installation
Check whether Nginx is running: systemctl status nginx
You should see: active (running)

If not running, start it manually: systemctl start nginx
Test the Web Server
Open any browser and enter your VM's public IP: http://
If the installation is successful, you will see the Nginx default welcome page.
Troubleshooting Tips
If you encounter issues:
1️⃣ Start Nginx : systemctl start nginx
2️⃣ Allow port 80 (HTTP) : ufw allow 80/tcp
3️⃣ Restart Nginx : systemctl restart nginx
You’ve successfully connected to a Linux VM using SSH and installed Nginx — a key skill for anyone learning cloud engineering or DevOps. Understanding how to deploy and manage web servers equips you for tasks like hosting applications, setting up reverse proxies, or preparing CI/CD pipelines.
This hands-on experience builds confidence and lays a strong foundation for more advanced topics like automation, configuration management, and containerized deployments.





Top comments (0)