How to Install NGINX on Ubuntu 20.04

NGINX is a popular, high-performance tool in HTTP. This tool is a reverse proxy server responsible for managing the traffic load of a large number of websites on the Internet. NGINX is a fast, open-source, freely available software tool used in traffic load balancing. NGINX provides a complete web server, a content management cache, and a reverse proxy feature for HTTP and non-HTTP servers. This article will show you how to install, set up, and uninstall NGINX on Ubuntu 20.04.

Installing NGINX

First, for NGINX to work, you should stop the Apache service running on port 80 or port 443.

Step 1: Update Your APT

As always, first, update and upgrade your APT.

$ sudo apt update

$ sudo apt upgrade

Step 2: Download and Install NGINX

The NGINX software tool is present in the Ubuntu official software repository. Simply type the following command in the terminal to download and install NGINX.

$ sudo apt install NGINX

Step 3: Verify Installation

When the installation completes, the Nginx service will start automatically. To verify this installation, execute the following terminal command.

$ sudo systemctl status NGINX

Step 4: Update Firewall Settings

Update the firewall settings through the UFW command to allow incoming traffic to your NGINX server from various HTTP and non-HTTP web servers on port 443, 80, or both of these ports.

$ sudo ufw allow ‘NGINX Full’

Step 5: Test Installation in Browser

Test your NGINX installation by opening a new tab in a browser on your Ubuntu machine and typing the following URL in the URL bar. Instead of the text “YOUR_IP,” put your own machine IP in the following command.

URL= http://YOUR_IP

Figure: NGINX testing server opened in a web browser tab.

Step 6: Test Installation in Command-Line Interface

You can also test the installation of NGINX via the command-line interface by executing the following terminal command.

$ curl -i 10.0.2.15

Step 7: Configure NGINX Server

Now you should configure your NGINX server for it to restart after system reboots.

$ sudo systemctl enable NGINX

You can also use the following additional commands to check the status of the NGINX server, in addition to restarting it, reloading it, starting it, stopping it, and disabling it from starting every time the system boots up.

$ sudo systemctl status NGINX

$ sudo systemctl restart NGINX

$ sudo systemctl reload NGINX

$ sudo systemctl start NGINX

$ sudo systemctl stop NGINX

$ sudo systemctl disable NGINX

Uninstalling NGINX Server

You can remove NGINX from Ubuntu via the following terminal commands.

$ sudo apt-get purge NGINX

$ sudo apt-get autoremove

Conclusion

We have covered how to install the NGINX server on Ubuntu 20.04 systems, how to set up and configure NGINX servers, and how to uninstall the NGINX tool from Ubuntu 20.04. Hope this helps.



from Linux Hint https://ift.tt/2MYXyZq

Post a Comment

0 Comments