{"id":331,"date":"2021-07-30T12:46:00","date_gmt":"2021-07-30T07:16:00","guid":{"rendered":"https:\/\/8xrgqe.tempavatar.click\/?p=331"},"modified":"2025-09-17T17:54:28","modified_gmt":"2025-09-17T12:24:28","slug":"install-nginx-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/sslforweb.com\/blog\/install-nginx-on-ubuntu-20-04\/","title":{"rendered":"Install Nginx on Ubuntu 20.04 LTS"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">What is Nginx?<\/h2>\n\n\n\n<p>Install <a href=\"https:\/\/www.nginx.com\/?ref=sslforweb.com\" target=\"_blank\" rel=\"noreferrer noopener\">Nginx<\/a>\u00a0to use a Fast,\u00a0<strong>Open Source<\/strong>, high-performance web server that commands a huge market share in production environments.\u00a0<strong>Nginx<\/strong>\u00a0is one of the most popular web servers\u00a0in the world and hosts some of the largest and highest-traffic sites on the internet.\u00a0<strong>Nginx<\/strong>\u00a0provides a content management cache, and a reverse proxy feature for HTTP and non-HTTP servers.<\/p>\n\n\n\n<p>This article will show you how to install, Services Manage, and Adjust Firewall.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Prerequisites<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The&nbsp;<strong>operating system<\/strong>&nbsp;running&nbsp;<a href=\"https:\/\/releases.ubuntu.com\/20.04?ref=sslforweb.com\" target=\"_blank\" rel=\"noreferrer noopener\">Ubuntu 20.04<\/a>&nbsp;<a href=\"https:\/\/www.linux.org\/?ref=techvblogs.com\" target=\"_blank\" rel=\"noreferrer noopener\">Linux<\/a><\/li>\n\n\n\n<li>A root or non-root user with&nbsp;<strong>sudo<\/strong>&nbsp;privileges<\/li>\n\n\n\n<li>A stable internet connection<\/li>\n\n\n\n<li>Make sure Apache or any other processes are not running on port 80 or 443<\/li>\n\n\n\n<li>Terminal window \/ Command line<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. Update Software Repositories<\/h3>\n\n\n\n<p><strong>Updating<\/strong>&nbsp;the local package with&nbsp;<strong>apt<\/strong>&nbsp;command. Open a terminal window and run the following command:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"211\" src=\"https:\/\/8xrgqe.tempavatar.click\/wp-content\/uploads\/2025\/09\/image-10-1024x211.png\" alt=\"\" class=\"wp-image-333\" title=\"\" srcset=\"https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-10-1024x211.png 1024w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-10-300x62.png 300w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-10-768x159.png 768w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-10.png 1201w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Upgrading<\/strong>&nbsp;the local package with&nbsp;<strong>apt<\/strong>&nbsp;command. Open a terminal window and run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt upgarde<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"275\" src=\"https:\/\/8xrgqe.tempavatar.click\/wp-content\/uploads\/2025\/09\/image-11-1024x275.png\" alt=\"\" class=\"wp-image-334\" title=\"\" srcset=\"https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-11-1024x275.png 1024w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-11-300x80.png 300w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-11-768x206.png 768w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-11-1536x412.png 1536w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-11.png 1886w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">3. Installing Nginx<\/h3>\n\n\n\n<p><strong>Nginx<\/strong>&nbsp;is available in the Ubuntu 20.04 default repositories. Run the following command and install Nginx:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install nginx<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"216\" src=\"https:\/\/8xrgqe.tempavatar.click\/wp-content\/uploads\/2025\/09\/image-12-1024x216.png\" alt=\"\" class=\"wp-image-336\" title=\"\" srcset=\"https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-12-1024x216.png 1024w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-12-300x63.png 300w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-12-768x162.png 768w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-12-1536x324.png 1536w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-12.png 1891w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">4. Verify Installation<\/h3>\n\n\n\n<p>When&nbsp;<strong>Nginx<\/strong>&nbsp;installed correctly, checking by the software version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nginx -v<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"914\" height=\"64\" src=\"https:\/\/8xrgqe.tempavatar.click\/wp-content\/uploads\/2025\/09\/image-13.png\" alt=\"\" class=\"wp-image-338\" title=\"\" srcset=\"https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-13.png 914w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-13-300x21.png 300w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-13-768x54.png 768w\" sizes=\"(max-width: 914px) 100vw, 914px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">5. Managing the Nginx Process<\/h3>\n\n\n\n<p>Now that you have your&nbsp;web server up and running, let&#8217;s go over basic management commands.<\/p>\n\n\n\n<p>To&nbsp;<strong>stop<\/strong>&nbsp;your web server, run this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl stop nginx <\/code><\/pre>\n\n\n\n<p>To&nbsp;<strong>start<\/strong>&nbsp;your web server, run this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start nginx<\/code><\/pre>\n\n\n\n<p>To&nbsp;<strong>reload<\/strong>&nbsp;your web server, run this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl reload nginx<\/code><\/pre>\n\n\n\n<p>To&nbsp;<strong>disable<\/strong>&nbsp;your web server, run this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl disable nginx<\/code><\/pre>\n\n\n\n<p>To&nbsp;<strong>enable<\/strong>&nbsp;your web server, run this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable nginx<\/code><\/pre>\n\n\n\n<p>To&nbsp;<strong>status<\/strong>&nbsp;your web server, run this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status nginx<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"207\" src=\"https:\/\/8xrgqe.tempavatar.click\/wp-content\/uploads\/2025\/09\/image-14-1024x207.png\" alt=\"\" class=\"wp-image-340\" title=\"\" srcset=\"https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-14-1024x207.png 1024w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-14-300x61.png 300w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-14-768x156.png 768w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-14.png 1382w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">6. Nginx Adjusting Firewall<\/h3>\n\n\n\n<p>Check the available&nbsp;<code>ufw<\/code>&nbsp;application profiles:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw app list<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"199\" src=\"https:\/\/8xrgqe.tempavatar.click\/wp-content\/uploads\/2025\/09\/image-15.png\" alt=\"\" class=\"wp-image-341\" title=\"\" srcset=\"https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-15.png 777w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-15-300x77.png 300w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-15-768x197.png 768w\" sizes=\"(max-width: 777px) 100vw, 777px\" \/><\/figure>\n\n\n\n<p>Let\u2019s enable the most restrictive profile that will still allow the traffic you\u2019ve configured, permitting traffic on port&nbsp;<code>80<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 'Nginx Full'<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"799\" height=\"133\" src=\"https:\/\/8xrgqe.tempavatar.click\/wp-content\/uploads\/2025\/09\/image-16.png\" alt=\"\" class=\"wp-image-342\" title=\"\" srcset=\"https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-16.png 799w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-16-300x50.png 300w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-16-768x128.png 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><\/figure>\n\n\n\n<p>Verify the change:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw status<\/code><\/pre>\n\n\n\n<p>If you&nbsp;have other applications or services to allow, make sure you configure your firewall to allow traffic.<\/p>\n\n\n\n<p>For example, using the&nbsp;<strong><code>sudo ufw allow 'OpenSSH'<\/code><\/strong>&nbsp;the command will enable secure, encrypted logins over the network.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">7. Test<\/h3>\n\n\n\n<p>For Verify it installed correctly Nginx, open a web browser and type in the address bar&nbsp;<code>http:\/\/server_ip_address<\/code><\/p>\n\n\n\n<p>After opening this URL, you can see the Nginx&nbsp;default page as in the image below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"751\" height=\"233\" src=\"https:\/\/8xrgqe.tempavatar.click\/wp-content\/uploads\/2025\/09\/image-17.png\" alt=\"\" class=\"wp-image-343\" style=\"width:751px;height:auto\" title=\"\" srcset=\"https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-17.png 751w, https:\/\/sslforweb.com\/blog\/wp-content\/uploads\/2025\/09\/image-17-300x93.png 300w\" sizes=\"(max-width: 751px) 100vw, 751px\" \/><\/figure>\n\n\n\n<p>This blog helped you install Nginx on Ubuntu using a set of simple commands.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Nginx? Install Nginx\u00a0to use a Fast,\u00a0Open Source, high-performance web server that commands a huge market share in production environments.\u00a0Nginx\u00a0is one of the most popular web servers\u00a0in the world and hosts some of the largest and highest-traffic sites on the internet.\u00a0Nginx\u00a0provides a content management cache, and a reverse proxy feature for HTTP and non-HTTP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":332,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,31],"tags":[18,17,15,16],"class_list":["post-331","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","category-nginx","tag-linux","tag-nginx","tag-ubuntu","tag-web-server"],"_links":{"self":[{"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/posts\/331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/comments?post=331"}],"version-history":[{"count":2,"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/posts\/331\/revisions"}],"predecessor-version":[{"id":462,"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/posts\/331\/revisions\/462"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/media\/332"}],"wp:attachment":[{"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/media?parent=331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/categories?post=331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sslforweb.com\/blog\/wp-json\/wp\/v2\/tags?post=331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}