LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

How to Install NGINX on a Debian 10 VPS

How to Install NGINX on a Debian 10 VPS This article was contributed by the folks at RackNerd – a provider of shared hosting, reseller hosting, VPS hosting, dedicated servers, DRaaS, colocation, and more. If you are looking for a VPS with full root access to set up NGINX on, be sure to review their latest LowEndBox special offers here.

NGINX is a popular open-source HTTP web server. It is known for its high-performance and feature-rich experience. NGINX is also used as a load balancer, mail proxy, and reverse proxy. It was released in 2004 and was created by Igor Sysoev. The majority of the web utilizes NGINX, especially as a load balancer.

Today, we are going to see how you can install and configure NGINX on your Debian 10 virtual private server. Let’s start the process.

  1. Requirements

Before you start, make sure that you have root access to your server.

  1. Install NGINX

The installation of NGINX is quite simple. It is available in Debian’s repositories, and it only takes a couple of commands to install it.

Run the following code to get NGINX installed:

sudo apt update

sudo apt install Nginx

Once these commands are executed, you will have NGINX installed on your system.

  1. Create a directory for your site

Now, we need to make a directory where your website can be saved.

Create the directory with the following command, replace “example.com” with your own domain name.

sudo mkdir /var/www/example.com

  1. Add the files for your site

Now, place the files for your existing website in this directory. However, if you do not yet have a website, you can make a simple index.html file to check the NGINX installation.

Create a new file named “Index.html” and paste the following content:

<!DOCTYPE html>



     <title>Hello, NGINX</title>




         <h1>Hello, NGINX!</h1>




 Configure NGINX

The site-specific configurations for NGINX can be found in the “/etc/nginx/sites-available” directory. These configuration files are linked to the directory “/etc/nginx/sites-enabled/”.

We need to create a new server black in the “/etc/nginx/sites-available” directory. Though, first, we need to remove the default configuration file. Run the following command to do so:

sudo unlink /etc/nginx/sites-enabled/default

Now, we will create a new file with the name of our web site’s domain name, e.g., “check.com”.

Paste the following in to this configuration file:

server {

listen 80;

listen [::]:80;

server_name  example.com;


root /var/www/example.com;

index index.html;


location / {

     try_files $uri $uri/ =404;



We need to link this file to the “/etc/nginx/sites-enabled/” directory. Run the following command:

sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/

  1. Test NGINX

We are done with the installation and the configuration of NGINX on our system. Now, it is time to test it.

To test the NGINX installation, run the following command:

sudo nginx -t

sudo nginx -s reload

If you now open your website in a web browser, you will be able to see the index.html page.

What is your favorite web server, is it NGINX? We would love to hear about your comments down below!

Jon Biloh


  1. Rhinox:

    Just small notice: there are actually 3 versions of nginx in debian repository: nginx-lite, nginx-full (iirc, this one is installed per default), and nginx-extras. You’d better check what modules you need before (if you do not want to re-compille nginx from sources). For example CachePurge or HeadersMore modules are enabled only in “nginx-extras”…

    January 26, 2021 @ 4:59 am | Reply
  2. J:

    +1 @Rhinox… also, you will find more current apache/php/ngnix packages in the repo of “ondrej”, especially if you are on older debian/ubuntu (I still have some VPS not yet moved to racknerd on old openVZ with 16.04 but running php 7.4).

    personally I do not see setting up nginx on it’s own. (we need php and mariadb to serve dynamic content – e.g. drupal, joomla, wordpress, etc.).

    therfore I would suggest using vestacp (or better, the great fork hestiacp) to manage the entire vps. then you can chose to use nginx alone or as reverse proxy with apache backend (still my preference at the moment).

    vestacp and hestiacp are running well on my racknerd nodes and coexist well with nodejs (also using nginx as proxy). allows you to manage the entire scope of your VPS (mariaDB, nginx, apache, php as well as eMail and dns with firewall and backups) for many domains! hestiacp takes <15 minutes to install and comfigure on your rackenerd VPS (suggest 2.5 or 3GB from their offerings – no, I am not compensated!)

    January 26, 2021 @ 11:06 am | Reply
  3. I would recommend use our deb package for Debian and Ubuntu


    We utilize the official Debian packaging scripts while pulling the latest mainline branch from Nginx official. You get the same experience as Debian / Ubuntu official nginx packages, except that you’ll get the latest release.

    January 26, 2021 @ 11:54 am | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *