{"id":23321,"date":"2023-12-31T19:18:01","date_gmt":"2023-12-31T19:18:01","guid":{"rendered":"https:\/\/linuxways.net\/?p=23321"},"modified":"2023-12-31T19:20:56","modified_gmt":"2023-12-31T19:20:56","slug":"install-nginx-in-debian-12","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/install-nginx-in-debian-12\/","title":{"rendered":"How to install Nginx in Debian 12"},"content":{"rendered":"<p>Web servers primarily act as a bridge between the web browsers and the clients as they store and deliver web pages as requested by the users. These servers use different protocols like HTTP for communication, SMTP for emails, and FTP for transferring files. Now there are different web server applications like Apache, Nginx, Lighttpd, and more yet each one serves a similar purpose but differs in its features. Nginx is a high-performance web server that is open-source and manages the incoming traffic by properly distributing it to upstream servers.<\/p>\n<h3><strong>Outline: <\/strong><\/h3>\n<ul>\n<li><a href=\"#post-23321-xxuj391zjfrn\"><strong>Install Nginx<\/strong><\/a><\/li>\n<li><a href=\"#post-23321-a3b0v12i3b3s\"><strong>Through Apt <\/strong><\/a><\/li>\n<li><a href=\"#post-23321-cbit3djhelia\"><strong>Through Official Repository<\/strong><\/a><\/li>\n<li><a href=\"#post-23321-3ikgla6ep33h\"><strong>Configuring Nginx<\/strong><\/a><\/li>\n<li><a href=\"#post-23321-3e5acvpacmye\"><strong>Removing Nginx<\/strong><\/a><\/li>\n<li><a href=\"#post-23321-3tyb83xz4wd2\"><strong>Conclusion<\/strong><\/a><\/li>\n<\/ul>\n<h2><a id=\"post-23321-xxuj391zjfrn\"><\/a><strong>How to install Nginx in Debian 12 <\/strong><\/h2>\n<p>Nginx uses an event-driven architecture which enables it to process multiple requests in a single process without blocking any of the input and output operations. At present, there are two versions of Nginx available officially, one is mainline while the other is stable so in this guide, we will install the mainline version. Like every application, Nginx on Debian 12 can be installed in two ways, one through an advanced packaging tool and the other by using its official repository:<\/p>\n<h2><a id=\"post-23321-a3b0v12i3b3s\"><\/a><strong>Method 1: Through the Default Repository<\/strong><\/h2>\n<p>Usually, all the applications that support the Debian distribution of Linux are available in its default repository but the main drawback of it is that sometimes the version of the application is quite old. To install Nginx through the advanced packaging tool on Debian 12 execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">apt-get install<\/span> nginx <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"793\" height=\"282\" class=\"wp-image-23327\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-1.png 793w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-1-300x107.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-1-768x273.png 768w\" sizes=\"auto, (max-width: 793px) 100vw, 793px\" \/><\/p>\n<p>Once the Nginx web server application is installed, verify it by finding its version and for that execute the version command like this:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> nginx <span class=\"re5\">-v<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"776\" height=\"204\" class=\"wp-image-23328\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-2.png 776w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-2-300x79.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-2-768x202.png 768w\" sizes=\"auto, (max-width: 776px) 100vw, 776px\" \/><\/p>\n<h2><a id=\"post-23321-cbit3djhelia\"><\/a><strong>Method 2: Through the Official Nginx Repository<\/strong><\/h2>\n<p>Another way to install Nginx on Debian is by using its official repository and here for installation I have installed the mainline version as it is relatively stable to use. Using a repository for the installation of an application on Debian can be fruitful as it may have a more latest version, so here are some steps to install Nginx from its official repository on Debian:<\/p>\n<h3><strong>Step 1: Setting up the Official Nginx Repository<\/strong><\/h3>\n<p>To step up the Nginx repository some prerequisites are to be installed which include curl gnupg2, ca-certificates, lsb-release, and debian-archive-keyring. So to install them execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> curl gnupg2 ca-certificates lsb-release debian-archive-keyring <span class=\"re5\">-y<\/span><\/div><\/div>\n<p>To further elaborate on the command above here are the purposes of the following prerequisites that are to be installed:<\/p>\n<ul>\n<li><strong>curl<\/strong> is a tool for transferring data from or to a server, using various protocols. It is used to fetch the Nginx signing key from its website.<\/li>\n<li><strong>gnupg2<\/strong> is a software used to validate the authenticity of the Nginx signing key.<\/li>\n<li><strong>ca-certificates<\/strong> is a package that contains the certificates that are trusted by Debian and are used to establish secure connections with the Nginx website and repository.<\/li>\n<li><strong>lsb-release<\/strong> is a package that provides information about the Linux Standard Base (LSB) and the specific distribution. It is used to determine the codename of the Debian version, such as bullseye or bookworm.<\/li>\n<li><strong>debian-archive-keyring <\/strong>is a package that contains the GnuPG keys of the Debian archive. It is used to validate the integrity of the Debian packages.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"767\" height=\"257\" class=\"wp-image-23329\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-3.png 767w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-3-300x101.png 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/p>\n<h3><strong>Step 2: Download the Nginx Signing Key <\/strong><\/h3>\n<p>Now use curl tool to download the singing key from the official website and afterward save that key to the Debian archive for keys used to validate the integrity of packages:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">curl https:<span class=\"sy0\">\/\/<\/span>nginx.org<span class=\"sy0\">\/<\/span>keys<span class=\"sy0\">\/<\/span>nginx_signing.key <span class=\"sy0\">|<\/span> gpg <span class=\"re5\">--dearmor<\/span> \\<br \/>\n<br \/>\n<span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">sudo<\/span> <span class=\"kw2\">tee<\/span> <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>share<span class=\"sy0\">\/<\/span>keyrings<span class=\"sy0\">\/<\/span>nginx-archive-keyring.gpg <span class=\"sy0\">&gt;\/<\/span>dev<span class=\"sy0\">\/<\/span>null<\/div><\/div>\n<p>Here I have combined both of the commands by using pipe:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"769\" height=\"240\" class=\"wp-image-23330\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-4.png 769w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-4-300x94.png 300w\" sizes=\"auto, (max-width: 769px) 100vw, 769px\" \/><\/p>\n<p>Once the key is saved, verify it by trying a dry run and if it is saved successfully then it will display the key in its output:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">gpg <span class=\"re5\">--dry-run<\/span> <span class=\"re5\">--quiet<\/span> <span class=\"re5\">--no-keyring<\/span> <span class=\"re5\">--import<\/span> <span class=\"re5\">--import-options<\/span> import-show <span class=\"sy0\">\/<\/span>usr<span class=\"sy0\">\/<\/span>share<span class=\"sy0\">\/<\/span>keyrings<span class=\"sy0\">\/<\/span>nginx-archive-keyring.gpg<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"233\" class=\"wp-image-23332\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-5.png 780w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-5-300x90.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-5-768x229.png 768w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><\/p>\n<h3><strong>Step 3: Add the Nginx Official Repository <\/strong><\/h3>\n<p>Now download the official repository and then save it directly to nginx.list file which is in the sources list directory of Debian:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">echo<\/span> <span class=\"st0\">&quot;deb [signed-by=\/usr\/share\/keyrings\/nginx-archive-keyring.gpg] \\ http:\/\/nginx.org\/packages\/debian <span class=\"es5\">`lsb_release -cs`<\/span> nginx&quot;<\/span> \\ <span class=\"sy0\">|<\/span> <span class=\"kw2\">sudo<\/span> <span class=\"kw2\">tee<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>apt<span class=\"sy0\">\/<\/span>sources.list.d<span class=\"sy0\">\/<\/span>nginx.list<\/div><\/div>\n<p>Here Both commands are piped and are executed simultaneously using a pipe, the echo command is just used for displaying the output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"779\" height=\"234\" class=\"wp-image-23334\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-6.png 779w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-6-300x90.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-6-768x231.png 768w\" sizes=\"auto, (max-width: 779px) 100vw, 779px\" \/><\/p>\n<p>Now set the priority for the Nginx packages by creating a priority file and here the priority is set based on the package version, its origin, its release and assigns the priority of 900 to the preferred packages:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">echo<\/span> <span class=\"re5\">-e<\/span> <span class=\"st0\">&quot;Package: *<span class=\"es1\">\\n<\/span>Pin: origin nginx.org<span class=\"es1\">\\n<\/span>Pin: release o=nginx<span class=\"es1\">\\n<\/span>Pin-Priority: 900<span class=\"es1\">\\n<\/span>&quot;<\/span> \\ <span class=\"sy0\">|<\/span> <span class=\"kw2\">sudo<\/span> <span class=\"kw2\">tee<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>apt<span class=\"sy0\">\/<\/span>preferences.d<span class=\"sy0\">\/<\/span>99nginx<\/div><\/div>\n<p>The purpose of this priority is to prefer Nginx packages first that are from the official repository.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"247\" class=\"wp-image-23335\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-7.png 785w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-7-300x94.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-7-768x242.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/p>\n<h3><strong>Step 4: Install Nginx on Debian Using Official Repository<\/strong><\/h3>\n<p>After setting up the Nginx official repository update the apt packages list so that the Nginx repository can be added to it and then install Nginx:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">Sudo apt <span class=\"kw2\">install<\/span> nginx <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"781\" height=\"475\" class=\"wp-image-23337\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-8.png 781w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-8-300x182.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-8-768x467.png 768w\" sizes=\"auto, (max-width: 781px) 100vw, 781px\" \/><\/p>\n<p>Once this web server is installed successfully start it and then verify the connection by sending a head request:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> nginx<br \/>\n<br \/>\n<span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span>curl <span class=\"re5\">-I<\/span> 127.0.0.1<\/div><\/div>\n<p>In return, if you receive the details about the server then it means that the server is up and running:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"344\" class=\"wp-image-23340\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-9.png 780w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-9-300x132.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-9-768x339.png 768w\" sizes=\"auto, (max-width: 780px) 100vw, 780px\" \/><\/p>\n<h2><a id=\"post-23321-3ikgla6ep33h\"><\/a><strong>Configuring Nginx on Debian 12 <\/strong><\/h2>\n<p>To make Nginx work properly it is necessary to configure it which includes allowing it through the firewall and setting its port. By default, there is no firewall installed on Debian so if you haven\u2019t installed previously then execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt <span class=\"kw2\">install<\/span> ufw <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"365\" class=\"wp-image-23342\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-10.png 777w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-10-300x141.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-10-768x361.png 768w\" sizes=\"auto, (max-width: 777px) 100vw, 777px\" \/><\/p>\n<p>Once the firewall is installed enable it as by default it is not enabled, in that case, execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> ufw <span class=\"kw3\">enable<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"767\" height=\"183\" class=\"wp-image-23343\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-11.png 767w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-11-300x72.png 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/p>\n<p>Once you have enabled the firewall to verify it by checking its status and for that purpose execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> ufw status<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"766\" height=\"165\" class=\"wp-image-23344\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-12.png 766w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-12-300x65.png 300w\" sizes=\"auto, (max-width: 766px) 100vw, 766px\" \/><\/p>\n<p>Now allow port 80 from the firewall as it will be used by the Nginx web server, the port 80 is the default port for the Debian system for HTTP:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> ufw allow <span class=\"nu0\">80<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"778\" height=\"334\" class=\"wp-image-23347\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-13.png 778w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-13-300x129.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-13-768x330.png 768w\" sizes=\"auto, (max-width: 778px) 100vw, 778px\" \/><\/p>\n<p>Now allow the Nginx HTTP if you are using port 80 and if you are using port 40 then allow the Nginx HTTPS:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> ufw allow \u2018Nginx HTTP\u2019<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"381\" class=\"wp-image-23350\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-14.png 764w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-14-300x150.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/p>\n<p>After adding the rules check for the firewall status usually it adds the rules, but there can be some exceptions. Next, check the firewall service status:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl status nginx<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"775\" height=\"227\" class=\"wp-image-23355\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-15.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-15.png 775w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-15-300x88.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-15-768x225.png 768w\" sizes=\"auto, (max-width: 775px) 100vw, 775px\" \/><\/p>\n<p>If the firewall is inactive then use the start command to activate it and afterward check its status:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> systemctl start nginx<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"767\" height=\"579\" class=\"wp-image-23362\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-16.png 767w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-16-300x226.png 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/p>\n<p>Now you are all set, to see if the default Nginx page is running just enter your local host address in your browser:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">http:<span class=\"sy0\">\/\/<\/span> <span class=\"sy0\">&lt;<\/span> Server-Ip-address<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"861\" height=\"518\" class=\"wp-image-23371\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-17.png 861w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-17-300x180.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-17-768x462.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-17-501x300.png 501w\" sizes=\"auto, (max-width: 861px) 100vw, 861px\" \/><\/p>\n<p><strong>Note:<\/strong> To create a custom website server using Nginx sometimes the folders like sites-enabled and sites-available are not created by default so in that case you have to create them by yourself:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">mkdir<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>nginx<span class=\"sy0\">\/<\/span>sites-available<br \/>\n<br \/>\n<span class=\"kw2\">sudo<\/span> <span class=\"kw2\">mkdir<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>nginx<span class=\"sy0\">\/<\/span>sites-enabled<\/div><\/div>\n<p><strong><br \/>\n<img loading=\"lazy\" decoding=\"async\" width=\"774\" height=\"209\" class=\"wp-image-23380\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-18.png 774w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-18-300x81.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-18-768x207.png 768w\" sizes=\"auto, (max-width: 774px) 100vw, 774px\" \/><\/strong><\/p>\n<p>Next, add the path for the sites-enable directory in the configuration file for EngineX so that the website you are creating can be enabled:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">include <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>nginx<span class=\"sy0\">\/<\/span>sites-enabled<span class=\"sy0\">\/*<\/span>;<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"770\" height=\"591\" class=\"wp-image-23393\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-19.png 770w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-19-300x230.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-19-768x589.png 768w\" sizes=\"auto, (max-width: 770px) 100vw, 770px\" \/><\/p>\n<h2><a id=\"post-23321-3e5acvpacmye\"><\/a><strong>Remove Nginx from Debian 12 <\/strong><\/h2>\n<p>To remove the Nginx from Debian in case you installed it through the default package manager then execute:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt remove <span class=\"re5\">--autoremove<\/span> nginx <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"772\" height=\"341\" class=\"wp-image-23400\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-20.png 772w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-20-300x133.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-20-768x339.png 768w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><\/p>\n<p>If you have installed Nginx through its official repository, then use the purge command as it will completely remove the Nginx from Debian:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> apt purge nginx <span class=\"re5\">-y<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"775\" height=\"276\" class=\"wp-image-23409\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-21.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-21.png 775w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-21-300x107.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2023\/12\/word-image-23321-21-768x274.png 768w\" sizes=\"auto, (max-width: 775px) 100vw, 775px\" \/><\/p>\n<h2><a id=\"post-23321-3tyb83xz4wd2\"><\/a><strong>Conclusion<\/strong><\/h2>\n<p>Nginx is a web server that can handle a high number of simultaneous connections despite using less number of resources and not only that it can support a wide range of protocols. To install it on Debian 12 there are two ways one is by using the default package manager and the other is by using the Nginx official repository. To make Nginx function properly, it is necessary to allow it through the firewall along with port 80 which is the default port for HTTP.<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>To install it on Debian 12 there are two ways one is by using the default package manager and the other is by using the Nginx official repository.<\/p>","protected":false},"author":110,"featured_media":23539,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-23321","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/23321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/110"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=23321"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/23321\/revisions"}],"predecessor-version":[{"id":23546,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/23321\/revisions\/23546"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/23539"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=23321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=23321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=23321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}