How to Install Nginx on Debian 10
Introduction
Within the world, Nginx is one of the well known web servers and it is consider for hosting some of the most important and highest-traffic sites on the internet. As compare to Apache, Nginx is more of resource-friendly and might be used as an web server or reverse proxy.
In this guide, we’ll discuss the way to install Nginx on your Debian 10 server.
Prerequisites
Before you start this guide, you ought to have a regular, non-root user with sudo privileges organized on your server and an active firewall. You’ll find out how to line these up by following our initial server setup guide for Debian 10.
When you have an account available, log in as your non-root user to start.
Step 1– Installing in Nginx
As a default repositories, Nginx is accessible in Debian’s , it’s possible to install it from these repositories using the apt packaging system.
During this session, being this can be often our initial interaction with the apt packaging system , let’s first update our local package so as index in order that we’ve access to the most recent package listings:
our local package index so that we have access to the most recent package listings:Now we can install nginx:
Hit Enter to proceed, once prompted to verify the installation. After that, apt can install Nginx and any needed dependencies to your server.
Step 2 – Adjusting the Firewall
Before testing Nginx, the firewall software needs to be adjusted to allow access to the service.
List the application configurations that ufw
knows how to work with by typing:
You should get a listing of the application profiles:
Available applications:
...
Nginx Full
Nginx HTTP
Nginx HTTPS
...
As you can see, there are three profiles available for Nginx:
- Nginx Full: This profile opens both port
80
(normal, unencrypted web traffic) and port443
(TLS/SSL encrypted traffic) - Nginx HTTP: This profile opens only port
80
(normal, unencrypted web traffic) - Nginx HTTPS: This profile opens only port
443
(TLS/SSL encrypted traffic)
It is recommended that you enable the most restrictive profile that will still allow the traffic you’ve configured. Since we haven’t configured SSL for our server yet in this guide, we will only need to allow traffic for HTTP on port 80
.
You can enable this by typing: