Share via

Linux VM Nginx Issue

Anonymous
2025-05-07T14:34:35.6866667+00:00

Team,

When I am trying to Issue Azure CLI commands for Installing Nginx server, I am facing issue.

Please see below and help me.

# Update apt cache.
sudo apt-get update

#We need to add repo before installing nginx-core. Otherwise we get an error
sudo add-apt-repository main
sudo add-apt-repository universe
sudo add-apt-repository restricted
sudo add-apt-repository multiverse  

# Install Nginx.
sudo apt-get install -y nginx

# Set the home page.
echo "<html><body><h2>Welcome to Azure! My name is $(hostname).</h2></body></html>" | sudo tee -a /var/www/html/index.html

Response from Bash shell follows:

sevagan1 [ ~ ]$ sudo apt-get update
sudo: The "no new privileges" flag is set, which prevents sudo from running as root.
sudo: If sudo is running in a container, you may need to adjust the container configuration to disable the flag.

Azure Virtual Machines
Azure Virtual Machines

An Azure service that is used to provision Windows and Linux virtual machines.


1 answer

Sort by: Most helpful
  1. Nikhil Duserla 9,940 Reputation points Microsoft External Staff Moderator
    2025-05-07T17:54:22.35+00:00

    Hello @Nandha Kumar,

    Please try the following commands to install NGINX on the Linux VM.

    we can install nginx:

    sudo apt update

    sudo apt install nginx

    List the application configurations that ufw knows how to work with by typing:

    sudo ufw app list

    You should get a listing of the application profiles:

    Output-

    Available applications:

    Nginx Full

    Nginx HTTP

    Nginx HTTPS

    OpenSSH

    It is recommended that you enable the most restrictive profile that will still allow the traffic you’ve configured. Right now, we will only need to allow traffic on port 80.

    You can enable this by typing:

    sudo ufw allow 'Nginx HTTP'

    You can verify the change by typing:

    sudo ufw status

    The output will indicated which HTTP traffic is allowed:

    At the end of the installation process, Ubuntu starts Nginx. The web server should already be up and running.

    We can check with the systemd init system to make sure the service is running by typing:

    systemctl status nginx

    Output-

    nginx.service - A high performance web server and a reverse proxy server

    Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)

    Active: active (running) since Fri 2020-04-20 16:08:19 UTC; 3 days ago

    Docs: man:nginx(8)

    Main PID: 2369 (nginx)

    Tasks: 2 (limit: 1153)

    Memory: 3.5M

    CGroup: /system.slice/nginx.service

       *`├─2369 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;`*
    
       *`└─2380 nginx: worker process`*
    

    When you have your server’s IP address, enter it into your browser’s address bar: [http://your_server_ip]

    If you have any further queries, do let us know.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.