Nginx is open-source software and is used as a web server, reverse proxying, caching system, load balancing system, and media streaming network, and so on. Also, to know what Nginx is, you should consider that Nginx is designed as a web server with maximum performance and stability. In this article, we are going to teach you How to Install Nginx on Ubuntu 22.04. You can also check out the packages available on the Eldernode website if you would like to purchase an Ubuntu VPS server.
Table of Contents
How to Setup Nginx on Ubuntu 22.04
Introduction to Nginx
In terms of hardware, a web server is a type of server that stores web server software and web-related components such as HTML documents, images, CSS style sheets, and JavaScript files. The web server connects to the Internet and supports the exchange of physical data with other devices connected to the web.
Nginx has been used as a web server since its inception, and as mentioned, it is now used as a reverse proxy, HTTP cache, and load balancing system on a variety of VPS servers.
Many well-known companies today use Nginx on their dedicated servers. Since the original release of NGINX, websites have evolved from simple HTML pages to dynamic and multifaceted content. NGINX has grown with it and now supports all modern web components, including Web Socket, HTTP/2, gRPC, and multi-format video playback (HDS, HLS, RTMP, and more). Also, if you need to buy SSL, you can easily install it on Nginx server.
Therefore, after selecting and registering the domain and purchasing the server, you can easily install Nginx on your VPS or dedicated servers and enjoy working with it.
In the continuation of this article, join us to teach you step by step how to install Nginx on Ubuntu 22.04.
Prerequisites for installing Nginx on Ubuntu 22.04
-> Use the newly installed operating system
-> SSH access to the server
-> A non-root sudo user or access to the root user
Installing Nginx on Ubuntu 22.04
In this section we want to show you How to Install Nginx on Ubuntu 22.04. To do this, just follow the steps below carefully and carefully.
It is recommended that you update the packages in the system in the first step using the following commands:
sudo apt update
sudo apt upgrade
Since Nginx is on the Ubuntu repository by default, you need to install the latest version by running the following command:
sudo apt install nginx
After you have successfully installed Nginx, you now need to enable it using the following command:
sudo systemctl enable nginx
Then you need to start Nginx with the help of the following command:
sudo systemctl start nginx
You can also check the status of Nginx:
sudo systemctl status nginx
Finally, you can confirm the installation of Nginx using the following command:
nginx -v
Firewall settings for Nginx access
In this section, we are going to adjusting the Firewall on Ubuntu 22.04. Since the UFW firewall runs on Ubuntu 22.04, you can easily enable the connection using the following command:
sudo ufw allow 'Nginx FULL'
Then you need to enable UFW with the following command:
sudo ufw enable
Finally you can check the status of UFW:
sudo ufw status
How to Run Web Server
Once you have successfully completed all the above steps, you will see that Nginx is running. To check the web server, just follow the steps below. You can check that the service is running using the following command:
systemctl status nginx
In the next step, you can access the default Nginx landing page by running the following command:
http://your_server_ip/
By runing the above command, you will see the following image:
Conclusion
As mentioned, NGINX is a web server that also acts as an email proxy, reverse proxy and load balancing. The structure of this software is asynchronous and event-driven, which allows the simultaneous processing of many requests. NGINX is also highly scalable, meaning that its services grow with its customer traffic. In this article, we tried to teach you How to Install Nginx on Ubuntu 22.04 with firewall configurations.