How to Install NGINX on Linux Mint

How to Install NGINX on Linux Mint

We will discuss the whole installation process of installing nginx on Linux Mint in a detailed manner. So stay tuned to find out more.

Linux is an open-source and easy-to-use, robust operating system. And nginx is a high-performance web server used by top-ranked companies. Installing ngnix on Linux provides an ideal combination. 

This article will tell you how to install nginx on Linux—along with a complete guide on how to configure it, use its features, and how to uninstall it too.

Introduction to nginx

Nginx is open-source software with the following features:

  • It supports the serving of web requests over hypertext transfer protocol (HTTP)
  • It supports revere proxying for HTTP, transmission control protocol (TCP), and user datagram protocol (UDP)
  • Cache management is supported
  • It provides load-balancing features
  • It can do media streaming

The advantages of nginx are its easy-to-use installation and very fast static file serving. And it has support for many concurrent connections and is a commonly used web app.

How to Install NGINX on Linux Mint

In this section, we will discuss the steps for the installation of Nginx on Linux Mint. To perform the installation and follow the steps below, it is required to have a Linux Mint operating system. You should have a user account with sudo or root access. Now, perform the following steps.

Update operating system

First, update the operating system to ensure the packages are up-to-date. On your terminal, type the following commands:

$sudo apt update && sudo apt upgrade -y

It is recommended to reboot your system after this step using the following command:

$sudo reboot

Verify sudo status

We assume that you have sudo right access to your system. To verify this, type the following command on your terminal:

$sudo whoami

If you want to use the root account, type the following command on your terminal:


Installation from a stable repository

The installation of Nginx is straightforward. The first approach is to install from a stable repository (i.e., Linux Mint’s default repository). The advantage is that they are stable and secure. Now, run the following command on your terminal:

$sudo apt install nginx

You will be asked to continue the installation by pressing “y”. 

To verify the installation, type the following:

$sudo nginx -v

Tip: This method is most feasible if you want to run a primary web server or reverse proxy.

Install from Nginx repository

First, add the Nginx public key into the system:

$sudo apt-key add nginx_signing.key

Use the following command to add Nginx:

For LinuxMint 18 

echo "deb xenial nginx" | sudo tee /etc/apt/sources.list.d/nginx.list

echo "deb-src xenial nginx" | sudo tee -a /etc/apt/sources.list.d/nginx.list

For LinuxMint 17

echo "deb trusty nginx" | sudo tee /etc/apt/sources.list.d/nginx.list

echo "deb-src trusty nginx" | sudo tee -a /etc/apt/sources.list.d/nginx.list

Now, update the repository list:

$sudo apt-get update

In the next step, install Nginx with the following command:

sudo apt-get install nginx

Starting Nginx service

Now, start the Nginx service through the following command:

For Linux Mint 18

$sudo systemctl start nginx

For Linux Mint  17

sudo service nginx start

Tip: You can also configure the system to start automatically via the following command:

$ sudo systemctl enable nginx

Now, check the status of Nginx service as follows:

$ sudo systemctl status nginx

Verifying that the Nginx service is running

You can verify that the service is running correctly by opening your browser and pointing your browser to the following address:


Alternatively, you can use the loopback address as follows:

You can also use the internet protocol (IP) address of your system as follows:


You should see the welcome page of Nginx, which confirms that Nginx is installed correctly on your system.

Tip: Instead of using the browser, you can also use the curl command to verify that the service is running as follows:

$ curl -1

Enabling firewall

Sometimes, you need to enable the UWF firewall. You should perform the following steps for this purpose.

Enable firewall

You can perform this step by using the following command:

$ sudo ufw enable

List down the applications

Now, list down the list of applications available for the firewall by using the following command:

$ sudo ufw app list

Enable HTTP and HTTPS ports (ports 80 and 4430)

Use the following command to enable HTTP and HTTPS ports:

$ sudo ufw allow 'Nginx FULL'

Reload the firewall

Reload the firewall now using the following command. This will apply to the changes we have made.

$sudo ufw reload

Confirm the rules

Confirm the updated rules by using the following command:

$ sudo ufw status

The directory structure of Nginx

The exact directory structure of Nginx depends on the particular source you used for the Nginx package. However, there should be folders for sites and configuration files (main configuration, default configuration, and additional configuration files).

Removing Nginx

Removing is not an ideal choice. But sometimes, you may want to remove the software. You can permanently remove the Nginx software by using the following command:

$ sudo apt autoremove nginx -purge

Tip: Nginx also serves as an SSL/TLS terminator between the client and web server, which is helpful for SSL negotiation.

In this guide, we have discussed the Nginx software and various ways to install the Nginx software on Linux Mint. We have also discussed how to configure, start and verify the service. Also, we discussed how we could enable the firewall. Finally, the steps for removing Nginx from your system are also discussed. Nginx is a highly recommended web server because of its high performance, scalability, and load-balancing features.

If this guide helped you, please share it.

Leave a Reply
Related Posts