[email protected]Office hours: Mon – Fri 9:00AM – 5:00PMLinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedSeptember 7, 2023

How to Install Nginx on Debian 10.

How To Install Nginx On Debian 10.

In this tutorial, we’ll explain how to install and manage Nginx on Debian 10 Buster.

Install Nginx

The Nginx package is included in the default Debian Buster repositories. The installation is pretty straightforward, just run the following commands as root or user with sudo privileges :

sudo apt update
sudo apt install nginx

Nginx service will automatically start after the installation process is complete. You can verify it with curl as shown below:

curl -I XX.XX.XX.XX

You can use the systemctl command to manage the Nginx service , same as any other systemd unit.

Adjust the Firewall

UFW users can open HTTP (80) and HTTPS (443) ports by enabling the ‘Nginx Full’ profile:

sudo ufw allow 'Nginx Full'Copy

If you are using nftables to filter connections to your system, open the necessary ports by issuing the following command:

nft add rule inet filter input tcp dport {80, 443} ct state new,establ

Nginx Configuration File’s Structure and Best Practices

  • Nginx configuration files are stored in the /etc/nginx directory.

  • The main Nginx configuration file is /etc/nginx/nginx.conf.

  • Server block (vhost) configuration files are stored in /etc/nginx/sites-available directory. The configuration files found in this directory are used by Nginx only when linked to the /etc/nginx/sites-enabled directory.

  • To activate a server blocks create a symlink (a pointer) from the configuration file in a sites-available directory to the sites-enabled directory.

  • To write more maintainable code, it’s a good idea to follow a standard naming convention. For example, if your domain name is mydomain.com then the configuration file should be named /etc/nginx/sites-available/mydomain.com.conf.

  • The /etc/nginx/snippets directory contains configuration snippets that can be included in the server block files. If you use repeatable configuration segments then you can refactor those segments into snippets and include the snippet file to the server blocks.

  • Nginx log files (access.log and error.log) are located in the /var/log/nginx/ directory. It is recommended to have a different access and error log files for each server block.

  • You can set your domain document root directory to any location you want. The most common locations for webroot include:

    • /home/<user_name>/<site_name>

    • /var/www/<site_name>

    • /var/www/html/<site_name>

    • /opt/<site_name>

Conclusion

Installing Nginx on Debian 10 is a matter of running a single command.

Now that you have installed Nginx on your Debian 10 Linux you can to start deploying your applications and use Nginx as a web or proxy server.

Keep reading
How to Implement Network Segmentation and Resource Isolation in Linux.
February 6, 2024

How to Implement Network Segmentation and Resource Isolation in Linux.

How to Implement Network Segmentation and Resource Isolation in Linux. Securing and managing networks in a Linux environment involves advanced practices like network segmentation and resource isolation. This guide explores these concepts, providing detailed instructions and examples for…

Read article
How to open or close ports in Linux.
February 6, 2024

How to open or close ports in Linux.

How to open or close ports in Linux. Effectively managing ports on your Linux system is crucial for both security and service accessibility. This comprehensive guide will provide a detailed walkthrough on opening and closing ports using the robust tools iptables and ufw. Understanding these…

Read article
How to use ypdomainname command.
January 23, 2024

How to use ypdomainname command.

How to use ypdomainname command. In the realm of Linux networking, the ypdomainname command plays a crucial role in the context of the Network Information Service (NIS). NIS, formerly known as Yellow Pages, is a distributed database service that facilitates the sharing of network configuration and…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, colocation, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Office hours: Mon – Fri 9:00AM – 5:00PM