NGINX Installation on Ubuntu 18.04/20.04

In this article, you will learn how to install NGINX Load Balancer on Ubuntu 18.04/20.4.

NGINX is open-source software for web serving, reverse proxying, caching, load balancing, media streaming, and more. It started out as a web server designed for maximum performance and stability. In addition to its HTTP server capabilities, NGINX can also function as a proxy server for email (IMAP, POP3, and SMTP) and a reverse proxy and load balancer for HTTP, TCP, and UDP servers.

Installing NGINX

Before starting with the installation of NGINX, first, you will have to stop the Apache service that runs on port 80 or port 443.

Update your package (APT) and then upgrade it.

$ sudo apt update

$ sudo apt upgrade

Download and install NGINX

Since the NGINX software is already present on the official ubuntu repository, you can run the following command in order to begin the installation procedure

$ sudo apt install nginx

Verify that NGINX is installed properly

When the installation is completed, you can verify that it runs on your server by typing the below command

$ sudo systemctl status NGINX

Update your firewall settings

To allow the traffic on your NGINX server from various HTTP and non-HTTP web servers at port 443,80 or both of these ports run the below command

$ sudo ufw allow 'NGINX Full'

Test installation in a browser

To test your NGINX installation on a web browser, open a new tab and type the URL of your server. E.g :

http://YOUR_SERVERS_IP

Test installation on CLI (Command Line Interface)

An alternative way to test your NGINX installation is to run the below command from CLI

$ curl -i YOUR_SERVERS_IP

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.

Start NGINX

$ sudo systemctl enable NGINX

Status of NGINX

$ sudo systemctl status NGINX

Restart NGINX service

$ sudo systemctl restart NGINX

Reload NGINX service

$ sudo systemctl reload NGINX

Stop NGINX

$ sudo systemctl stop NGINX

Disable NGINX

$ sudo systemctl disable NGINX

In case you wish to uninstall NGINX service from your server, you can run the below commands

$ sudo apt-get purge NGINX

$ sudo apt-get autoremove

  • nginx, smtp, proxy server, load balancer
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Disable OpenDNS resolver on Windows Server Operating Systems

An open DNS resolver is a DNS server that responds to recursive DNS queries from any IP address...

Disable OpenDNS resolver on Windows Server Operating Systems

An open DNS resolver is a DNS server that responds to recursive DNS queries from any IP address...

Disable OpenDNS resolver on Windows Server Operating Systems

An open DNS resolver is a DNS server that responds to recursive DNS queries from any IP address...

Enable GUI on Ubuntu Server (18.04/20.04)

In this article, we take a look at how to install GUI on Ubuntu server 18.04 and 20.04. Because...

Enable GUI on Ubuntu Server (18.04/20.04)

In this article, we take a look at how to install GUI on Ubuntu server 18.04 and 20.04. Because...