How to Install Nginx on Ubuntu 16.04

r00t April 6, 2018

Install Nginx on Ubuntu 16.04

In this tutorial we will show you how to install Nginx on Ubuntu 16.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 16.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 16.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.

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

apt-get install nginx

Once the instillation is completed, you can make sure that Nginx service is running with the following command:

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
-- ------ ----
Nginx Full ALLOW Anywhere
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 16.04 server. Thanks for using this tutorial installing Nginx web server on Ubuntu 16.04 LTS (Xenial Xerus) system.

The Tags:

Leave a Comment

Comments are closed.