NGINX acts as a forward proxy server for email protocols (IMAP, SMTP, and POP3). Moreover, NGINX provides reverse proxy server and load balancing support for well-known computer protocols such as HTTP, TCP, and UDP servers.
NGINX is available for various Linux systems such as Debian, CentOS, RedHat Enterprise Linux (REHL), and more. This writeup acts as an installation guide of NGINX on Ubuntu 22.04.
How to install NGINX on Ubuntu 22.04
This section enlists various steps to install NGINX on Ubuntu 22.04 from the official repository of Ubuntu 22.04.
Step 1: Update the system’s packages by issuing the following command:
Step 2: Once the system’s packages are updated, you can install NGINX with the help of the following command:
Step 3: Verify the installation by checking version of NGINX:
Get the status of the NGINX service as follows:
You can enable the NGINX service to start the service at the startup of the system automatically:
Moreover, you can restart and start the NGINX service by using the following commands:
$ sudo systemctl start nginx
Step 4: Now, you need to configure the firewall to allow traffic on HTTP port 80 and HTTP port 443. You can use the following command to get the traffic on both ports for NGINX:
Reload the firewall to adapt to the changes:
Step 5: Once the NGINX is installed and configured properly. You can use the following address in the browser to check whether NGINX is running or not:
Or you can get the result on the terminal via the following command:
The output shows the HTML code of the welcome page of NGINX.
How to remove NGINX from Ubuntu 22.04
NGINX server can be removed from Ubuntu 22.04 with the help of the following command. This command removes the NGINX server alongside its dependencies from Ubuntu 22.04:
Conclusion
NGINX is the web server that provides various services such as web proxy server, email proxy server, load balancing, media streaming, etc. NGINX server is available on the official repository of Ubuntu 22.04; therefore, it can be installed using a simple set of commands. Alongside the installation, you have learned the basic configuration of the NGINX server as well.