Deploying static site in Azure VM with Nginx

Yash BhangaleYash Bhangale
1 min read

Table of contents

open terminal and ssh (ipaddress) of vm

ssh 74.225.215.114
sudo apt update 
sudo apt upgrade
sudo apt install nginx

Create a directory for your static website files:

sudo mkdir -p /var/www/html/your-website
sudo chown -R $USER:$USER /var/www/html/your-website
nano /var/www/html/your-website/index.html
sudo nano /etc/nginx/sites-available/your-website
server {
    listen 80;
    server_name your_domain_or_IP;

    root /var/www/html/your-website;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}
sudo ln -s /etc/nginx/sites-available/your-website /etc/nginx/sites-enabled/
sudo systemctl reload nginx

0
Subscribe to my newsletter

Read articles from Yash Bhangale directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Yash Bhangale
Yash Bhangale