How To Install Nginx on Ubuntu 20.04 LTS

How To Install Nginx on Ubuntu 20.04 LTS

In this tutorial, we want to talk about How To Install Nginx on Ubuntu 20.04 LTS and its configuration and show how you can install Nginx on Ubuntu 20.04 in a few steps.

Tutorial Configure and Install Nginx on Ubuntu 20.04 LTS

Step 1) Install Nginx

First, you should update the local package with below command:

sudo apt update

Then install Nginx with the command below:

sudo apt install nginx

Step 2) Adjusting the Firewall on ubuntu 20.04

First, you have needed that enable the UFW firewall.

Then Check the available UFW firewall application profiles with the command below:

sudo ufw app list

Output:

Available applications:
Nginx Full
Nginx HTTP
Nginx HTTPS
OpenSSH

Now enable permitting traffic on port 80:

sudo ufw allow 'Nginx HTTP'

You should Verify the change:

sudo ufw status

Output:

Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere                  
Nginx HTTP                 ALLOW       Anywhere                  
OpenSSH (v6)               ALLOW       Anywhere (v6)             
Nginx HTTP (v6)            ALLOW       Anywhere (v6)

Step 3) Check Web Server

Check to see if the web server is running:

systemctl status nginx

The output should be as follows:

nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset:>
     Active: active (running) since Mon 2020-05-07 21:35:26 UTC; 2min 20s ago
       Docs: man:nginx(8)
   Main PID: 13255 (nginx)
      Tasks: 2 (limit: 1137)
     Memory: 4.6M
     CGroup: /system.slice/nginx.service
             ├─13255 nginx: master process /usr/sbin/nginx -g daemon on; master>
             └─13256 nginx: worker process

Then you should check Access the default Nginx landing page in the browser with the command below:

http://your_server_ip

After entering the IP address on the browser, you should see the default Nginx landing page:

Install Nginx

 

If you want to create a more complete application, you can read the article How to install a lamp on Ubuntu 20.04 we published earlier.

If you have any questions about configuring and Install Nginx, you can question them in the Ask Eldernode.

 

Use of this Site is subject to express terms of use. By using this site, you signify that you agree to be bound by these