Introduction
NGINX is a popular open-source web server known for its high performance, reliability, and scalability. Initially released in 2004, it has since gained widespread adoption and is commonly used as a web server, reverse proxy server, load balancer, and HTTP cache.
Installing Nginx web server
After creating linux virtual machine, you can install Nginx web server using the following steps:
- Find out what IP address your Linux virtual machine is publicly known as using the code: az vm list-ip-addresses --name MyVM --output table. The name of the virtual machine created virtual machine is MyVM
- After obtaining the Public IP address from the previous step, establish an SSH connection to MyVM using the code ssh azureuser@ip-address
3.To install the nginx web server, enter the following command after logging into the virtual machine. It will take a few moments to finish the command.
sudo apt-get -y update && sudo apt-get -y install nginx
- quit the secure shell using the code exit
How to get default webpage
- To access the default page from your Linux web server using curl in Azure Cloud Shell, use the following command, changing to the public IP you previously discovered. Another option is to try opening a new tab in your browser and accessing the public IP address. curl -m 80
The reason this command fails is that the network security group that protects the virtual machine's network connectivity does not allow the Linux virtual machine to expose port 80 (http). By using the Azure CLI command vm open-port, we can resolve the issue.
- To open port 80 in Cloud Shell, enter the following command: az vm open-port \ --port 80 \ --resource-group MyResourceGroup \ --name MyVM
- Use the curl command once again.
This time, the following data should be returned. The page is also visible in a browser by searching the ip address in a browser.
Top comments (0)