How to install Nginx on Ubuntu 18


This post will guide you how to install Nginx on Ubuntu 18.04 but this can apply to Ubuntu 16.04 also.

In the series about Nginx:

Step 1: Adding repo

Run this command to add repo to Ubuntu

vi /etc/apt/sources.list

add these lines at the bottom of this file

deb bionic nginx

run these commands to add signing keys

sudo wget
sudo apt-key add nginx_signing.key

Step 2: Install Nginx

Run these commands to install

sudo apt update
sudo apt install nginx

Run these commands to setup Nginx

sudo systemctl start nginx
sudo systemctl enable nginx