Javatpoint Logo
Javatpoint Logo

Installing NGINX on Debian/Ubuntu

There are two ways to install NGINX on Debian and Ubuntu:

  • Using a pre-built binary: - This method is an easier and faster method.
  • Building it up from source: - This method provides the ability to include various third-party modules that make Nginx even more powerful.

Following are the steps which will show us how to install Nginx on our Debian or Ubuntu system:

Step 1:

First of all let us update our local package index, so that we have access to the most recent package listings.

Open the terminal on Ubuntu or Debian, and run the following command to ensure that all packages on the OS are up to date:


How to Install NGINX on Debian/Ubuntu

Since, Nginx is available in default repository of Debian or Ubuntu, it is possible to install it from these repositories using the apt packaging system.


How to Install NGINX on Debian/Ubuntu

Once it is done, use the following command to see the process for the web server in a running state.


How to Install NGINX on Debian/Ubuntu

Adjusting the firewall to access Nginx

For accessing the Nginx from the web server, we have to allow the access the services from outside.

To see the list of profiles available to allow from the firewall, use the following command:

How to Install NGINX on Debian/Ubuntu

Here,

Nginx Full: It allows the both ports 80 and 443.

Nginx HTTP: It allows only the port 80.

Nginx HTTPS: It allows only the port 443.

To allow the both ports HTTP 80 and HTTPS 443, use the following command:

To allow only Nginx HTTP port 80, use the following command:


How to Install NGINX on Debian/Ubuntu

To allow only Nginx HTTPS port 443, use the following command:

Checking the NGINX Service Status

By default, after the installation of Ubuntu, the Nginx starts automatically and we can check the status of the Nginx with the help of following command:


How to Install NGINX on Debian/Ubuntu




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA