{"id":468,"date":"2025-01-10T23:09:19","date_gmt":"2025-01-10T19:09:19","guid":{"rendered":"https:\/\/hostatto.com\/blog\/?p=468"},"modified":"2025-01-11T18:19:46","modified_gmt":"2025-01-11T14:19:46","slug":"install-nginx-on-debian-12","status":"publish","type":"post","link":"https:\/\/hostatto.com\/blog\/install-nginx-on-debian-12.html","title":{"rendered":"Install NGINX on Debian 12"},"content":{"rendered":"<p>Install the packages required to connect the apt repository<\/p>\n<blockquote><p>sudo apt install curl gnupg2 ca-certificates lsb-release debian-archive-keyring<\/p><\/blockquote>\n<p>Now you need to import the official key that apt uses to authenticate packages. Download the key<\/p>\n<blockquote><p>curl https:\/\/nginx.org\/keys\/nginx_signing.key | gpg --dearmor \\<br \/>\n| sudo tee \/usr\/share\/keyrings\/nginx-archive-keyring.gpg &gt;\/dev\/null<\/p><\/blockquote>\n<p>Check if the correct key was loaded:<\/p>\n<blockquote><p>gpg --dry-run --quiet --no-keyring --import --import-options import-show \/usr\/share\/keyrings\/nginx-archive-keyring.gpg<\/p><\/blockquote>\n<p>The command output must contain the full key fingerprint<\/p>\n<blockquote><p>pub rsa2048 2011-08-19 [SC] [expires: 2027-05-24]<br \/>\n573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62<br \/>\nuid nginx signing key &lt;signing-key@nginx.com&gt;<\/p><\/blockquote>\n<p>The command output may contain other keys used to sign packages.<br \/>\nTo connect the apt repository for the stable version of NGINX, run the following command:<\/p>\n<blockquote><p>echo \"deb [signed-by=\/usr\/share\/keyrings\/nginx-archive-keyring.gpg] \\<br \/>\nhttp:\/\/nginx.org\/packages\/debian `lsb_release -cs` nginx\" \\<br \/>\n| sudo tee \/etc\/apt\/sources.list.d\/nginx.list<\/p><\/blockquote>\n<p>To use packages from NGINX repository instead of Debian distributed, write:<\/p>\n<blockquote><p>echo -e \"Package: *\\nPin: origin nginx.org\\nPin: release o=nginx\\nPin-Priority: 900\\n\" \\<br \/>\n| sudo tee \/etc\/apt\/preferences.d\/99nginx<\/p><\/blockquote>\n<p>To install NGINX, run the following commands:<\/p>\n<blockquote><p>sudo apt update<br \/>\nsudo apt install nginx<\/p><\/blockquote>\n<p>Now let's check the installed version of NGINX<\/p>\n<blockquote><p>nginx -v<\/p><\/blockquote>\n<p>Now enable the NGINX service<\/p>\n<blockquote><p>sudo systemctl enable nginx<\/p><\/blockquote>\n<p>And start the NGINX service<\/p>\n<blockquote><p>sudo systemctl start nginx<\/p><\/blockquote>\n<p>And check NGINX status<\/p>\n<blockquote><p>sudo systemctl status nginx<\/p><\/blockquote>\n<p>Status must be active<\/p>\n<blockquote><p>nginx.service - nginx - high performance web server<br \/>\nLoaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; preset: enabled)<br \/>\nActive: <strong>active (running)<\/strong> since Fri 2025-01-10 20:18:24 EST; 12s ago<br \/>\nDocs: https:\/\/nginx.org\/en\/docs\/<br \/>\nProcess: 9440 ExecStart=\/usr\/sbin\/nginx -c \/etc\/nginx\/nginx.conf (code=exited, status=0\/SUCCESS)<\/p><\/blockquote>\n<p>Now in the address bar of your browser type<\/p>\n<blockquote><p>http:\/\/localhost\/<\/p><\/blockquote>\n<p>You should see a message<\/p>\n<blockquote><p>Welcome to nginx!<\/p><\/blockquote>\n<p>NGINX server installation is complete<\/p>\n<p>How to set up a NGINX server for Debian 12 is <a href=\"https:\/\/hostatto.com\/blog\/blog\/linux\/set-up-a-nginx-server-for-debian-12.html\">written here<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>...<\/p>\n","protected":false},"author":1,"featured_media":505,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[62,33],"class_list":["post-468","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-debian-12","tag-nginx"],"_links":{"self":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/posts\/468","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/comments?post=468"}],"version-history":[{"count":0,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/posts\/468\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/media\/505"}],"wp:attachment":[{"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/media?parent=468"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/categories?post=468"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hostatto.com\/blog\/wp-json\/wp\/v2\/tags?post=468"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}