{"id":7499,"date":"2020-05-15T07:59:21","date_gmt":"2020-05-15T07:59:21","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=7499"},"modified":"2022-02-17T11:43:43","modified_gmt":"2022-02-17T11:43:43","slug":"how-to-install-nginx-on-ubuntu-16-04","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/","title":{"rendered":"How to install Nginx on Ubuntu 16.04?"},"content":{"rendered":"<p>Nginx is a Linux web server that can be used as a reverse proxy, load balancer, mail proxy, and HTTP cache. It accelerates the content by utilizing very low resources and thus is known as a competitor to Apache. To install Nginx on Ubuntu 16.04 follow the steps mentioned in the tutorial.<\/p>\n<h2>Prerequisite :<\/h2>\n<p>To explain this tutorial we are working on Ubuntu 16.04 LTS server and also logged in as root.<\/p>\n<h3>#Steps to install Nginx<\/h3>\n<p><strong>1) Update Apt-Get<\/strong><\/p>\n<p>First, we will update and upgrade our packet manager using the following command.<\/p>\n<pre class=\"lang:default decode:true\">apt-get update &amp;&amp; apt-get upgrade<\/pre>\n<p><strong>2) Install Nginx<\/strong><\/p>\n<p>Below command will install Nginx<\/p>\n<pre class=\"lang:default decode:true \">apt-get -y install nginx<\/pre>\n<p><strong>3) Verify the installation of Nginx<\/strong><\/p>\n<p>If the Nginx is installed correctly, then an Nginx\u2019s default file will get appear in \/var\/www\/html as index.nginx-debian.html . In case you see the Apache default page then rename it as index.html file. Just like Apache, the port for Nginx is also port 80, which indicates that if you already have set your record A for your server\u2019s hostname, then you can visit the IP and verify if the installation of Nginx is completed. By the following command if you can get the IP of your server, in case if you don\u2019t have :<\/p>\n<pre class=\"lang:default decode:true \">ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's\/\\\/.*$\/\/'<\/pre>\n<p>Now, use this IP command and visit via HTTP (http:\/\/xxx.xxx.xxx.xxx).<\/p>\n<p>Now you can see a similar screen as below, to verify the installation of Nginx.<\/p>\n<p><a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-13621 size-full\" src=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png\" alt=\"Nginx welcome\" width=\"679\" height=\"414\" srcset=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png 679w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome-300x183.png 300w\" sizes=\"auto, (max-width: 679px) 100vw, 679px\" \/><\/a><\/p>\n<h3>How to change ports for Apache?<\/h3>\n<p>In case if you already have Apache established to port 80, then you may find the Apache default page when you visit your host IP. So, you can change this port, in order to make a place for Nginx to take over port 80. To change the Apache port, you will have to visit the Apache port configuration file :<\/p>\n<pre class=\"lang:default decode:true \">vim \/etc\/apache2\/ports.conf<\/pre>\n<p>Here, change \u201cListen 80\u201d to any other port number, for example, we can use port 8080 :<\/p>\n<pre class=\"lang:default decode:true \">Listen 8080<\/pre>\n<p>Now, to notice the changes, restart Apache,<\/p>\n<pre class=\"lang:default decode:true \">service apache2 restart<\/pre>\n<p>All the things that Apache has can now be seen using your IP by replacing the x\u2019s.<\/p>\n<p>For example http:\/\/xxx.xxx.xxx.xxx:8080.<\/p>\n<p><strong>Also Read :<\/strong><\/p>\n<p><strong>1) <\/strong><a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/block-ips-with-nginx\/\" target=\"_blank\" rel=\"noopener\">How to Block IPs with Nginx?<\/a><\/p>\n<p><strong>2)<\/strong> <a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/steps-to-redirect-urls-using-nginx\/\" target=\"_blank\" rel=\"noopener\">Steps to Redirect URLs Using Nginx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nginx is a Linux web server that can be used as a reverse proxy, load balancer, mail proxy, and HTTP cache. It accelerates the content by utilizing very low resources and thus is known as a competitor to Apache. To install Nginx on Ubuntu 16.04 follow the steps mentioned in the tutorial. Prerequisite : To [&hellip;]<\/p>\n","protected":false},"author":18,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[13,1426,630,848,1427,1428,1429,664],"class_list":["post-7499","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-howtos","tag-apache","tag-apache2","tag-linux","tag-nginx","tag-optimization","tag-port","tag-ports","tag-ubuntu-16-04"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to install Nginx on Ubuntu 16.04?<\/title>\n<meta name=\"description\" content=\"A step by step process to install Nginx on Ubuntu 16.04.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to install Nginx on Ubuntu 16.04?\" \/>\n<meta property=\"og:description\" content=\"A step by step process to install Nginx on Ubuntu 16.04.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2020-05-15T07:59:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-17T11:43:43+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png\" \/>\n<meta name=\"author\" content=\"Sonam Wagh\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sonam Wagh\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/\",\"name\":\"How to install Nginx on Ubuntu 16.04?\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png\",\"datePublished\":\"2020-05-15T07:59:21+00:00\",\"dateModified\":\"2022-02-17T11:43:43+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4\"},\"description\":\"A step by step process to install Nginx on Ubuntu 16.04.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/#primaryimage\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png\",\"contentUrl\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png\",\"width\":679,\"height\":414,\"caption\":\"Nginx welcome\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to install Nginx on Ubuntu 16.04?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4\",\"name\":\"Sonam Wagh\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g\",\"caption\":\"Sonam Wagh\"},\"description\":\"With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/sonam\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to install Nginx on Ubuntu 16.04?","description":"A step by step process to install Nginx on Ubuntu 16.04.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/","og_locale":"en_GB","og_type":"article","og_title":"How to install Nginx on Ubuntu 16.04?","og_description":"A step by step process to install Nginx on Ubuntu 16.04.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2020-05-15T07:59:21+00:00","article_modified_time":"2022-02-17T11:43:43+00:00","og_image":[{"url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png","type":"","width":"","height":""}],"author":"Sonam Wagh","twitter_misc":{"Written by":"Sonam Wagh","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/","name":"How to install Nginx on Ubuntu 16.04?","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/#primaryimage"},"image":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png","datePublished":"2020-05-15T07:59:21+00:00","dateModified":"2022-02-17T11:43:43+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4"},"description":"A step by step process to install Nginx on Ubuntu 16.04.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/#primaryimage","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png","contentUrl":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2020\/05\/Nginx-welcome.png","width":679,"height":414,"caption":"Nginx welcome"},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/how-to-install-nginx-on-ubuntu-16-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"How to install Nginx on Ubuntu 16.04?"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/dc645d02823c86e07e53798ebe02c6f4","name":"Sonam Wagh","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9cb2cf6ae11d7625ef6417ef8e84ba25?s=96&d=blank&r=g","caption":"Sonam Wagh"},"description":"With an interest in doing something creative daily, Sonam works as a Digital Marketing Executive. She likes to write technical blogs related to web hosting, digital marketing, and other IT topics. She also likes to spend her leisure time on social media to find different strategies for client engagement.","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/sonam\/"}]}},"views":461,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/7499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=7499"}],"version-history":[{"count":3,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/7499\/revisions"}],"predecessor-version":[{"id":13622,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/7499\/revisions\/13622"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=7499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=7499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=7499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}