How to Install Nginx on Ubuntu 18.04

r00t May 4, 2018

Install Nginx on Ubuntu 18.04

In this tutorial we will show you how to install Nginx on Ubuntu 18.04. We will also install and configure its prerequisites. Nginx is one of the most common open source web server software. It is widely used for load balancing, reverse proxying, media streaming and much more. The specialization of Nginx is its capability to operate on little resource and handle a high number of requests. Nginx works as an internet server, proxy, load balancer and Reverse Proxy. Today Nginx is installed on more afterward 450 million servers net, and is used by a few of the maximum traffic sites on the internet such as Dropbox and Netflix.

I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an Ubuntu 18.04 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Nginx on Ubuntu 18.04

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

apt-get update -y
apt-get upgrade -y

Step 2. Installing Nginx on Ubuntu 18.04 Bionic Beaver.

Nginx is available in the Ubuntu package repositories simple. Follow this command to install Nginx:

apt-get install nginx

Once the installation is completed, check the status and the version of the Nginx service, with:

systemctl start nginx
systemctl enable nginx

Step 3. Configure Firewall ports for Nginx.

If you are using ufw you need to open HTTP port 80 and/or HTTPS port 433:

sudo ufw allow 'Nginx Full'

To verify the change run:

### sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
Nginx Full                 ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
Nginx Full (v6)            ALLOW       Anywhere (v6)

Step 4. Test Nginx in your browser.

Now in your browser’s address bar, type the public IP address of Ubuntu 16.04 LTS server. You should see the “Welcome to nginx!” Web page which means Nginx Web server is running correctly.

Congratulation’s! You have successfully install and configured Nginx on your Ubuntu 18.04 Bionic Beaver server. Thanks for using this tutorial installing Nginx web server on Ubuntu 18.04 LTS (Bionic Beaver) system.

The Tags:

Leave a Comment

Comments are closed.