{"id":376,"date":"2016-11-11T03:40:52","date_gmt":"2016-11-11T03:40:52","guid":{"rendered":"https:\/\/draculaservers.com\/tutorials\/?p=376"},"modified":"2024-01-18T13:57:10","modified_gmt":"2024-01-18T13:57:10","slug":"installing-nginx-ubuntu-16-04","status":"publish","type":"post","link":"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/","title":{"rendered":"Installing Nginx on Ubuntu 16.04"},"content":{"rendered":"\n<h2 id=\"whats-nginx\">What\u2019s Nginx?<\/h2>\n<p>Nginx is a popular open-source web server used for hosting sites known for its high-performance, simple configuration and stability.<\/p>\n<h2 id=\"what-youll-need\">What You\u2019ll Need<\/h2>\n<p>Before proceeding with this tutorial you\u2019ll need a root user account and Ubuntu 16.04 running on your server.<\/p>\n<h2 id=\"installing-nginx\">Installing Nginx<\/h2>\n<p>Ubuntu has Nginx in its default repositories, so after we update our local package index, we can start installing nginx.<\/p>\n<pre>sudo apt-get update\r\n\r\nsudo apt-get install nginx<\/pre>\n<h2 id=\"configuring-your-firewall\">Configuring your Firewall<\/h2>\n<p>We need to modify some things in our firewall to give Nginx access. List the firewall\u2019s configurations with the following line:<\/p>\n<pre>sudo ufw app list<\/pre>\n<p>And you should get the following applications:<\/p>\n<pre>Output\r\n\r\nAvailable applications:\r\n\r\nNginx Full\r\n\r\nNginx HTTP\r\n\r\nNginx HTTPS\r\n\r\nOpenSSH<\/pre>\n<p><strong>Nginx Full<\/strong> \u2013 opens port 80 (unencrypted traffic) and port 443 (TLS\/SSL encrypted traffic)<\/p>\n<p><strong>Nginx HTTP<\/strong> \u2013 opens only port 80<\/p>\n<p><strong>Nginx HTTPS<\/strong> \u2013 opens only port 443<\/p>\n<p>To enable one of the applications you type:<\/p>\n<pre>sudo ufw allow 'Nginx HTTP'<\/pre>\n<p>To check your status type the following:<\/p>\n<pre>sudo ufw status<\/pre>\n<h3 id=\"checking-your-server\">Checking your Server<\/h3>\n<p>By now your web server should be running, but you can check with the following command:<\/p>\n<pre>systemctl status nginx<\/pre>\n<p>And an output should appear saying the service started successfully.<\/p>\n<p>Or you can type you server\u2019s IP address\/domain into your browser:<\/p>\n<pre class=\"\">http:\/\/server_domain_or_IP<\/pre>\n<p>And Nginx&#8217;s default landing page should appear.<\/p>\n<h2 id=\"nginx-commands\">Nginx Commands<\/h2>\n<p>Since you now have a functional server let\u2019s list a few basic commands that you\u2019ll use later on.<\/p>\n<p>To start your web server if it is stopped:<\/p>\n<pre class=\"\">sudo systemctl start nginx<\/pre>\n<p>If you want to stop your server, type:<\/p>\n<pre>sudo systemctl stop nginx<\/pre>\n<p>For restarting server, type:<\/p>\n<pre>sudo systemctl restart nginx<\/pre>\n<p>To reload Nginx (if you\u2019re configuring something and what to see the changes you\u2019ve made):<\/p>\n<pre>sudo systemctl reload nginx<\/pre>\n<p>If you want to disable Nginx start up at boot feature, type:<\/p>\n<pre>sudo systemctl disable nginx<\/pre>\n<p>And to re-enable it:<\/p>\n<pre>sudo systemctl enable nginx<\/pre>\n<h2 id=\"nginx-files-and-directories\">Nginx files and directories<\/h2>\n<p>Here we will discuss some files and directories which you\u2019ll be needing in future configurations and installations.<\/p>\n<ul>\n<li><em>\/var\/www\/html<\/em>: web content; by default it only contains Nginx\u2019s landing page;<\/li>\n<li><em>\/etc\/nginx:<\/em> configuration directory, all Nginx configuration files can be found here;<\/li>\n<li><em>\/etc\/nginx\/nginx.conf<\/em>: main Nginx configuration file, here you can modify Nginx global configurations;<\/li>\n<li><em>\/etc\/nginx\/sites-available<\/em>: all server block configs are made in this directory;<\/li>\n<li><em>\/etc\/nginx\/sites-enabled\/<\/em>: here enable server blocks are stored. Nginx will not use sites-availableif it is not linked to this directory.<\/li>\n<li><em>\/etc\/nginx\/snippets<\/em>: contains configuration fragments that can be used in other Nginx configurations;<\/li>\n<li><em>\/var\/log\/nginx\/access.log:<\/em> requests to your web server are stored in this log file;<\/li>\n<li><em>\/var\/log\/nginx\/error.log<\/em>:this log contains Nginx errors.<\/li>\n<\/ul>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>If you\u2019ve made it this far you should now have Nginx\u00a0installed and running and you can start hosting sites on your server. Obviously there is so much more you can do with Nginx, but here we just covered the installation part, a simple yet important step in your journey of becoming a web master.<\/p>\n<p>Need a reliable server to start hosting your sites? Check out our <a href=\"https:\/\/draculaservers.com\/kvm.php\">high performance Linux VPS<\/a> starting at 2GB RAM for only $5\/mo.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What\u2019s Nginx? Nginx is a popular open-source web server used for hosting sites known for its high-performance, simple configuration and stability. What You\u2019ll Need Before proceeding with this tutorial you\u2019ll need a root user account and Ubuntu 16.04 running on your server. Installing Nginx Ubuntu has Nginx in its default repositories, so after we update [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,6,22],"tags":[],"class_list":["post-376","post","type-post","status-publish","format-standard","hentry","category-getting-started","category-hosting","category-ubuntu"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":6}},"featured_image_urls_v2":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":"","pk-small":"","pk-thumbnail":""},"post_excerpt_stackable_v2":"<p>What\u2019s Nginx? Nginx is a popular open-source web server used for hosting sites known for its high-performance, simple configuration and stability. What You\u2019ll Need Before proceeding with this tutorial you\u2019ll need a root user account and Ubuntu 16.04 running on your server. Installing Nginx Ubuntu has Nginx in its default repositories, so after we update our local package index, we can start installing nginx. sudo apt-get update sudo apt-get install nginx Configuring your Firewall We need to modify some things in our firewall to give Nginx access. List the firewall\u2019s configurations with the following line: sudo ufw app list And&hellip;<\/p>\n","category_list_v2":"<a href=\"https:\/\/draculaservers.com\/tutorials\/category\/getting-started\/\" rel=\"category tag\">Getting Started<\/a>, <a href=\"https:\/\/draculaservers.com\/tutorials\/category\/hosting\/\" rel=\"category tag\">Hosting<\/a>, <a href=\"https:\/\/draculaservers.com\/tutorials\/category\/ubuntu\/\" rel=\"category tag\">Ubuntu<\/a>","author_info_v2":{"name":"Vlad","url":"https:\/\/draculaservers.com\/tutorials\/author\/vlad\/"},"comments_num_v2":"0 comments","yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Step-by-Step Guide: Installing Nginx on Ubuntu 16.04<\/title>\n<meta name=\"description\" content=\"This comprehensive tutorial provides a detailed step-by-step guide to set up Nginx on Ubuntu 16.04, enabling you to establish a robust web server effortlessly.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Step-by-Step Guide: Installing Nginx on Ubuntu 16.04\" \/>\n<meta property=\"og:description\" content=\"This comprehensive tutorial provides a detailed step-by-step guide to set up Nginx on Ubuntu 16.04, enabling you to establish a robust web server effortlessly.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/\" \/>\n<meta property=\"og:site_name\" content=\"Dracula Servers Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2016-11-11T03:40:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-18T13:57:10+00:00\" \/>\n<meta name=\"author\" content=\"Vlad\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vlad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/installing-nginx-ubuntu-16-04\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/installing-nginx-ubuntu-16-04\\\/\"},\"author\":{\"name\":\"Vlad\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/931f7fa8b2126ace6edfb82775e0ec0e\"},\"headline\":\"Installing Nginx on Ubuntu 16.04\",\"datePublished\":\"2016-11-11T03:40:52+00:00\",\"dateModified\":\"2024-01-18T13:57:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/installing-nginx-ubuntu-16-04\\\/\"},\"wordCount\":494,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#organization\"},\"articleSection\":[\"Getting Started\",\"Hosting\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/installing-nginx-ubuntu-16-04\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/installing-nginx-ubuntu-16-04\\\/\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/installing-nginx-ubuntu-16-04\\\/\",\"name\":\"Step-by-Step Guide: Installing Nginx on Ubuntu 16.04\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#website\"},\"datePublished\":\"2016-11-11T03:40:52+00:00\",\"dateModified\":\"2024-01-18T13:57:10+00:00\",\"description\":\"This comprehensive tutorial provides a detailed step-by-step guide to set up Nginx on Ubuntu 16.04, enabling you to establish a robust web server effortlessly.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/installing-nginx-ubuntu-16-04\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/installing-nginx-ubuntu-16-04\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/installing-nginx-ubuntu-16-04\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Installing Nginx on Ubuntu 16.04\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#website\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/\",\"name\":\"Dracula Servers Tutorials\",\"description\":\"Dedicated Servers\",\"publisher\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#organization\",\"name\":\"Dracula Servers\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/dracula_full_logo_smaller.png\",\"contentUrl\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/wp-content\\\/uploads\\\/2016\\\/06\\\/dracula_full_logo_smaller.png\",\"width\":1625,\"height\":200,\"caption\":\"Dracula Servers\"},\"image\":{\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/draculaservers.com\\\/tutorials\\\/#\\\/schema\\\/person\\\/931f7fa8b2126ace6edfb82775e0ec0e\",\"name\":\"Vlad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/499c7a24aa9727703300a291f8f69dfd1b01b8d6a19a4ae4fbe669b4b12b8cbe?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/499c7a24aa9727703300a291f8f69dfd1b01b8d6a19a4ae4fbe669b4b12b8cbe?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/499c7a24aa9727703300a291f8f69dfd1b01b8d6a19a4ae4fbe669b4b12b8cbe?s=96&d=mm&r=g\",\"caption\":\"Vlad\"},\"description\":\"Tech Support\",\"sameAs\":[\"https:\\\/\\\/draculaservers.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Step-by-Step Guide: Installing Nginx on Ubuntu 16.04","description":"This comprehensive tutorial provides a detailed step-by-step guide to set up Nginx on Ubuntu 16.04, enabling you to establish a robust web server effortlessly.","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:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/","og_locale":"en_US","og_type":"article","og_title":"Step-by-Step Guide: Installing Nginx on Ubuntu 16.04","og_description":"This comprehensive tutorial provides a detailed step-by-step guide to set up Nginx on Ubuntu 16.04, enabling you to establish a robust web server effortlessly.","og_url":"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/","og_site_name":"Dracula Servers Tutorials","article_published_time":"2016-11-11T03:40:52+00:00","article_modified_time":"2024-01-18T13:57:10+00:00","author":"Vlad","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Vlad","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/#article","isPartOf":{"@id":"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/"},"author":{"name":"Vlad","@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/person\/931f7fa8b2126ace6edfb82775e0ec0e"},"headline":"Installing Nginx on Ubuntu 16.04","datePublished":"2016-11-11T03:40:52+00:00","dateModified":"2024-01-18T13:57:10+00:00","mainEntityOfPage":{"@id":"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/"},"wordCount":494,"commentCount":0,"publisher":{"@id":"https:\/\/draculaservers.com\/tutorials\/#organization"},"articleSection":["Getting Started","Hosting","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/","url":"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/","name":"Step-by-Step Guide: Installing Nginx on Ubuntu 16.04","isPartOf":{"@id":"https:\/\/draculaservers.com\/tutorials\/#website"},"datePublished":"2016-11-11T03:40:52+00:00","dateModified":"2024-01-18T13:57:10+00:00","description":"This comprehensive tutorial provides a detailed step-by-step guide to set up Nginx on Ubuntu 16.04, enabling you to establish a robust web server effortlessly.","breadcrumb":{"@id":"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/draculaservers.com\/tutorials\/installing-nginx-ubuntu-16-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/draculaservers.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Installing Nginx on Ubuntu 16.04"}]},{"@type":"WebSite","@id":"https:\/\/draculaservers.com\/tutorials\/#website","url":"https:\/\/draculaservers.com\/tutorials\/","name":"Dracula Servers Tutorials","description":"Dedicated Servers","publisher":{"@id":"https:\/\/draculaservers.com\/tutorials\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/draculaservers.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/draculaservers.com\/tutorials\/#organization","name":"Dracula Servers","url":"https:\/\/draculaservers.com\/tutorials\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/logo\/image\/","url":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2016\/06\/dracula_full_logo_smaller.png","contentUrl":"https:\/\/draculaservers.com\/tutorials\/wp-content\/uploads\/2016\/06\/dracula_full_logo_smaller.png","width":1625,"height":200,"caption":"Dracula Servers"},"image":{"@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/draculaservers.com\/tutorials\/#\/schema\/person\/931f7fa8b2126ace6edfb82775e0ec0e","name":"Vlad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/499c7a24aa9727703300a291f8f69dfd1b01b8d6a19a4ae4fbe669b4b12b8cbe?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/499c7a24aa9727703300a291f8f69dfd1b01b8d6a19a4ae4fbe669b4b12b8cbe?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/499c7a24aa9727703300a291f8f69dfd1b01b8d6a19a4ae4fbe669b4b12b8cbe?s=96&d=mm&r=g","caption":"Vlad"},"description":"Tech Support","sameAs":["https:\/\/draculaservers.com"]}]}},"_links":{"self":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts\/376","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/comments?post=376"}],"version-history":[{"count":1,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts\/376\/revisions"}],"predecessor-version":[{"id":2187,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/posts\/376\/revisions\/2187"}],"wp:attachment":[{"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/media?parent=376"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/categories?post=376"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/draculaservers.com\/tutorials\/wp-json\/wp\/v2\/tags?post=376"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}