{"id":881,"date":"2021-01-05T10:51:39","date_gmt":"2021-01-05T05:21:39","guid":{"rendered":"http:\/\/192.168.0.6\/linuxbots\/?p=881"},"modified":"2023-09-20T03:30:56","modified_gmt":"2023-09-19T22:00:56","slug":"how-to-install-nginx-on-ubuntu-18-04-server","status":"publish","type":"post","link":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/","title":{"rendered":"How To Install Nginx on Ubuntu 18.04 Server"},"content":{"rendered":"\n<p>Nginx is the second most used web server in the world. According to the <a aria-label=\"Netcraft survey (opens in a new tab)\" href=\"https:\/\/news.netcraft.com\/archives\/2019\/08\/15\/august-2019-web-server-survey.html\" target=\"_blank\" rel=\"noreferrer noopener\">Netcraft survey<\/a>, Nginx is used by approx 25% of the busiest sites on the web. In this tutorial, we&#8217;ll <strong>install Nginx on Ubuntu 18.04 LTS server<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"747\" height=\"506\" src=\"https:\/\/oracle.itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg\" alt=\"install-nginx-on-ubuntu-18.04\" class=\"wp-image-3448\" srcset=\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg 747w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1-300x203.jpg 300w\" sizes=\"auto, (max-width: 747px) 100vw, 747px\" \/><\/figure>\n\n\n\n<p>Nginx is mainly known for its low resource consumptions and high performance. Nginx can be used as a web server or reverse proxy with apache in the frontend.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_80 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69d75584af76a\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69d75584af76a\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Step_1_%E2%80%93_Install_Nginx_on_Ubuntu\" >Step 1 &#8211; Install Nginx on Ubuntu<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Step_2_%E2%80%93_Configure_Firewall\" >Step 2 &#8211; Configure Firewall<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Step_3_%E2%80%93_Enable_and_Verify_Nginx_Service\" >Step 3 &#8211; Enable and Verify Nginx Service<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Step_4_%E2%80%93_Understanding_Configuration_Files_Structure\" >Step 4 &#8211; Understanding Configuration File\u2019s Structure<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Config_Files\" >Config Files<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Content_Files\" >Content Files<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Log_Files\" >Log Files<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Step_5_%E2%80%93_Configure_a_Server_Block_Virtual_Host\" >Step 5 &#8211; Configure a Server Block (Virtual Host)<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Restart_or_Reload_Nginx_on_Ubuntu\" >Restart or Reload Nginx on Ubuntu<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-prerequisites\"><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Before you follow this tutorial, you should have a non-root user with sudo privilege.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-1-install-nginx-on-ubuntu\"><span class=\"ez-toc-section\" id=\"Step_1_%E2%80%93_Install_Nginx_on_Ubuntu\"><\/span>Step 1 &#8211; Install Nginx on Ubuntu<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Ubuntu&#8217;s default repositories are having Nginx. So, we just need to install Nginx using the default repositories.<\/p>\n\n\n\n<p>Above all, we have to update the list of available packages in the repository. After that, we will <strong>install Nginx on Ubuntu 18.04<\/strong> by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get update\nsudo apt-get install nginx<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-2-configure-firewall\"><span class=\"ez-toc-section\" id=\"Step_2_%E2%80%93_Configure_Firewall\"><\/span>Step 2 &#8211; Configure Firewall<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>UFW (Uncomplicated Firewall) is the default firewall configuration tool for Ubuntu. By default UFW is disabled. Use the below command to enable the UFW.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw enable<\/code><\/pre>\n\n\n\n<p>During installation, Nginx registers itself with UFW. Therefore, allowing Nginx in UFW is very simple. You can see the list of registered application in UFW using the below command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw app list<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Output:\nAvailable applications:\n   Nginx Full\n   Nginx HTTP\n   Nginx HTTPS\n   OpenSSH<\/pre>\n\n\n\n<p>Here we have three different profiles for Nginx.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Nginx Full<\/strong> &#8211; For allowing both port 80 (HTTP) and port 443 (HTTPS).<\/li><li><strong>Nginx HTTP<\/strong> &#8211; For allowing only port 80 (HTTP)<\/li><li><strong>Nginx HTTPS<\/strong> &#8211; For allowing only port 443 (HTTPS)<\/li><\/ul>\n\n\n\n<p>For better security, you should only allow those ports which are used. Because we do not configure SSL in this tutorial, we only allow port 80 (HTTP) for now. Allow Nginx HTTP using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 'Nginx HTTP'<\/code><\/pre>\n\n\n\n<p>After that, check the firewall status by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw status<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Output:\nStatus: active\n To                         Action      From\n --                         ------      ----\n OpenSSH                    ALLOW       Anywhere                  \n Nginx HTTP                 ALLOW       Anywhere                  \n OpenSSH (v6)               ALLOW       Anywhere (v6)             \n Nginx Full (v6)            ALLOW       Anywhere (v6)             \n Nginx HTTP (v6)            ALLOW       Anywhere (v6)<\/pre>\n\n\n\n<p>In the above output, you can see Nginx HTTP is allowed in firewall now.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-3-enable-and-verify-nginx-service\"><span class=\"ez-toc-section\" id=\"Step_3_%E2%80%93_Enable_and_Verify_Nginx_Service\"><\/span>Step 3 &#8211; Enable and Verify Nginx Service<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>By default, Nginx Service is enabled and started during installation. In case if it not enabled and started automatically. You can <strong>Enable and Start the Nginx service on Ubuntu<\/strong> by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable nginx\nsudo systemctl start nginx<\/code><\/pre>\n\n\n\n<p>After that, you can see the current status of the service by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl status nginx<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">Output: \u25cf nginx.service - A high performance web server and a reverse proxy server     Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled)     Active: active (running) since Wed 2020-02-12 07:17:55 UTC; 2h 20min ago       Docs: man:nginx(8)   Main PID: 11664 (nginx)      Tasks: 2 (limit: 1108)     CGroup: \/system.slice\/nginx.service             \u251c\u250011664 nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on;             \u2514\u250011667 nginx: worker process  Feb 12 07:17:55 demo.linuxbots.com systemd[1]: Starting A high performance web server and a reverse proxy server\u2026<\/pre>\n\n\n\n<p>To verify, If you enter the domain or IP of the server in a web browser you can see the Nginx welcome page on it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"536\" height=\"206\" src=\"https:\/\/oracle.itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/nginx-welcome-page-1.png\" alt=\"nginx-welcome-page\" class=\"wp-image-3449\" srcset=\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/nginx-welcome-page-1.png 536w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/nginx-welcome-page-1-300x115.png 300w\" sizes=\"auto, (max-width: 536px) 100vw, 536px\" \/><figcaption>Nginx Welcome Page<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-4-understanding-configuration-file-s-structure\"><span class=\"ez-toc-section\" id=\"Step_4_%E2%80%93_Understanding_Configuration_Files_Structure\"><\/span>Step 4 &#8211; Understanding Configuration File\u2019s Structure<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>As a result, now you know how to <strong>install Nginx on Ubuntu<\/strong> and how to add the UFW rule for it. But you should understand the configuration files structure to <strong>configure Nginx Server<\/strong>. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-config-files\"><span class=\"ez-toc-section\" id=\"Config_Files\"><\/span>Config Files<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<figure class=\"wp-block-table is-style-regular\"><table><tbody><tr><td><strong>Directory or File<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td>\/etc\/nginx\/<\/td><td>All the nginx configuration files are located in this directory.<\/td><\/tr><tr><td>\/etc\/nginx\/nginx.conf<\/td><td>The main configuration file for Nginx. Changes in this file applied globally.<\/td><\/tr><tr><td>\/etc\/nginx\/sites-available\/<\/td><td>Config files of all the available Server Blocks (Virtual Hosts) are located here.<\/td><\/tr><tr><td>\/etc\/nginx\/sites-enabled\/<\/td><td>Softlink&#8217;s of all the enabled virtual hosts are located here. You have to create a soft link of the server blocks config file to enable it.<\/td><\/tr><tr><td>\/etc\/nginx\/snippets\/<\/td><td>Frequently used configurations are can be saved as snippets and can be used repeatedly easily.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-content-files\"><span class=\"ez-toc-section\" id=\"Content_Files\"><\/span>Content Files<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Directory or File<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td>\/var\/www\/html\/<\/td><td>By default, All the contents of web application are stored in this directory. This can be changed by configuration.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-log-files\"><span class=\"ez-toc-section\" id=\"Log_Files\"><\/span>Log Files<span class=\"ez-toc-section-end\"><\/span><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td><strong>Directory or File<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td>\/var\/log\/nginx\/<\/td><td>All the log files of Nginx are located in this directory.<\/td><\/tr><tr><td>\/var\/log\/nginx\/access.log<\/td><td>Default Access log file for the Nginx web server.<\/td><\/tr><tr><td>\/var\/log\/nginx\/error.log<\/td><td>Default Error log file for the Nginx web server.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-5-configure-a-server-block-virtual-host\"><span class=\"ez-toc-section\" id=\"Step_5_%E2%80%93_Configure_a_Server_Block_Virtual_Host\"><\/span>Step 5 &#8211; Configure a Server Block (Virtual Host)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Server Blocks are used when we want to serve multiple domains from a single server. In Apache web server they known as Virtual Hosts.<\/p>\n\n\n\n<p>For this tutorial, we configure a Server Block for the domain <strong>demo.linuxbots.com<\/strong>, remember to replace it with your own domain name.<\/p>\n\n\n\n<p>Meanwhile, the default configuration of Nginx is serve the <strong>\/var\/www\/html\/<\/strong> directory contents. The default config is working well with a single site but it can not be used with multiple site setup.<\/p>\n\n\n\n<p>We will create a new directory and a new server block config file for our domain. So let&#8217;s start by creating the directory structure for our example domain by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo mkdir -p \/var\/www\/demo.linuxbots.com\/html<\/code><\/pre>\n\n\n\n<p>After that, change the ownership of the directories by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chown -R $USER:www-data \/var\/www\/demo.linuxbots.com<\/code><\/pre>\n\n\n\n<p>Now, change the permission of the folder. The default permission is okay if you did not change anything. Otherwise, change the permission by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chmod -R 755 \/var\/www\/demo.linuxbots.com<\/code><\/pre>\n\n\n\n<p>In case you want to make the directory writable by the webserver. Use the below permissions.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chmod -R 775 \/var\/www\/demo.linuxbots.com<\/code><\/pre>\n\n\n\n<p>After that, create an example index file in the HTML directory created in the previous step.<\/p>\n\n\n\n<p>vim  \/var\/www\/demo.linuxbots.com\/html\/index.html<\/p>\n\n\n\n<p>Enter some example HTML code and save the file. You can also use the below HTML code.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;html&gt;\n    &lt;body&gt;\n        &lt;h1&gt;Welcome the Linuxbots.com&lt;\/h1&gt;\n\t&lt;h3&gt;The exmaple Config for nginx is working...&lt;\/h3&gt;\n    &lt;\/body&gt;\n&lt;\/html&gt;<\/code><\/pre>\n\n\n\n<p>Finally, create a server block in <strong>\/etc\/nginx\/sites-available\/<\/strong> by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vim \/etc\/nginx\/sites-available\/demo.linuxbots.com<\/code><\/pre>\n\n\n\n<p>Enter the below contents in the file and replace demo.linuxbots.com with your own domain name. After that save the file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>server {\n        listen 80;\n        listen &#91;::]:80;\n\n        root \/var\/www\/demo.linuxbots.com\/html;\n        index index.html;\n\n        server_name demo.linuxbots.com;\n\n        location \/ {\n                try_files $uri $uri\/ =404;\n        }\n}<\/code><\/pre>\n\n\n\n<p>We have changed the server name and root directory in this configuration.<\/p>\n\n\n\n<p>Now, Enable this configuration by creating a soft-link to <strong>\/etc\/nginx\/sites\/enabled\/<\/strong> directory. Use the below command for this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ln -s \/etc\/nginx\/sites-available\/demo.linuxbots.com \/etc\/nginx\/sites-enabled\/demo.linuxbots.com<\/code><\/pre>\n\n\n\n<p>After that, you check the configuration by using the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nginx -t<\/code><\/pre>\n\n\n\n<p>You should see the following output.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-restart-or-reload-nginx-on-ubuntu\"><span class=\"ez-toc-section\" id=\"Restart_or_Reload_Nginx_on_Ubuntu\"><\/span>Restart or Reload Nginx on Ubuntu<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p>Now, restart or reload the Nginx service for applying the changes by using the below commands.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl restart nginx<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl reload nginx<\/code><\/pre>\n\n\n\n<p>Nginx should now be serving your server block. To verify it point your browser to the server block domain name. You should see the content which we write in the index file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"587\" height=\"283\" src=\"https:\/\/oracle.itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/example-server-block-nginx-1.jpg\" alt=\"example-server-block-nginx\" class=\"wp-image-3450\" srcset=\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/example-server-block-nginx-1.jpg 587w, https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/example-server-block-nginx-1-300x145.jpg 300w\" sizes=\"auto, (max-width: 587px) 100vw, 587px\" \/><figcaption>Example Server Block Nginx<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>As a result, we have successfully <strong>install Nginx on Ubuntu 18.04<\/strong> Sever. You can share your views in the comment section.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Also Read: <a href=\"https:\/\/oracle.itsupportwale.com\/blog\/install-laravel-on-ubuntu-16-04-with-apache\/\">Install Laravel on Ubuntu 16.04 with Apache<\/a><\/li><\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Nginx is the second most used web server in the world. According to the Netcraft survey, Nginx is used by approx 25% of the busiest sites on the web. In this tutorial, we&#8217;ll install Nginx on Ubuntu 18.04 LTS server. Nginx is mainly known for its low resource consumptions and high performance. Nginx can be &#8230; <a title=\"How To Install Nginx on Ubuntu 18.04 Server\" class=\"read-more\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/\" aria-label=\"Read more  on How To Install Nginx on Ubuntu 18.04 Server\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":3448,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[498,500,377,504,2,7,506],"tags":[528,227,541,8,9],"class_list":["post-881","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-foss","category-linux","category-nginx","category-tutorial","category-tutorials","category-ubuntu","category-web-server","tag-installation","tag-nginx","tag-nginx-webserver","tag-ubuntu","tag-ubuntu-18-04"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Install Nginx on Ubuntu 18.04 Server - ITSupportWale<\/title>\n<meta name=\"description\" content=\"In this tutorial, we&#039;ll learn, How to Install Nginx on Ubuntu 18.04 LTS server. It is the second most used web server in the world.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Install Nginx on Ubuntu 18.04 Server - ITSupportWale\" \/>\n<meta property=\"og:description\" content=\"In this tutorial, we&#039;ll learn, How to Install Nginx on Ubuntu 18.04 LTS server. It is the second most used web server in the world.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/\" \/>\n<meta property=\"og:site_name\" content=\"ITSupportWale\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Itsupportwale-298547177495978\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-05T05:21:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-19T22:00:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"747\" \/>\n\t<meta property=\"og:image:height\" content=\"506\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Techie\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Techie\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/\"},\"author\":{\"name\":\"Techie\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d\"},\"headline\":\"How To Install Nginx on Ubuntu 18.04 Server\",\"datePublished\":\"2021-01-05T05:21:39+00:00\",\"dateModified\":\"2023-09-19T22:00:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/\"},\"wordCount\":985,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg\",\"keywords\":[\"installation\",\"nginx\",\"nginx webserver\",\"ubuntu\",\"ubuntu 18.04\"],\"articleSection\":[\"FOSS\",\"Linux\",\"Nginx\",\"Tutorial\",\"Tutorials\",\"Ubuntu\",\"Web Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/\",\"url\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/\",\"name\":\"How To Install Nginx on Ubuntu 18.04 Server - ITSupportWale\",\"isPartOf\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg\",\"datePublished\":\"2021-01-05T05:21:39+00:00\",\"dateModified\":\"2023-09-19T22:00:56+00:00\",\"description\":\"In this tutorial, we'll learn, How to Install Nginx on Ubuntu 18.04 LTS server. It is the second most used web server in the world.\",\"breadcrumb\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#primaryimage\",\"url\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg\",\"contentUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg\",\"width\":747,\"height\":506,\"caption\":\"install-nginx-on-ubuntu-18.04\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/itsupportwale.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Install Nginx on Ubuntu 18.04 Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#website\",\"url\":\"https:\/\/itsupportwale.com\/blog\/\",\"name\":\"ITSupportWale\",\"description\":\"Tips, Tricks, Fixed-Errors, Tutorials &amp; Guides\",\"publisher\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/itsupportwale.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#organization\",\"name\":\"itsupportwale\",\"url\":\"https:\/\/itsupportwale.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png\",\"contentUrl\":\"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png\",\"width\":1119,\"height\":144,\"caption\":\"itsupportwale\"},\"image\":{\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Itsupportwale-298547177495978\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d\",\"name\":\"Techie\",\"sameAs\":[\"https:\/\/itsupportwale.com\",\"iswblogadmin\"],\"url\":\"https:\/\/itsupportwale.com\/blog\/author\/iswblogadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Install Nginx on Ubuntu 18.04 Server - ITSupportWale","description":"In this tutorial, we'll learn, How to Install Nginx on Ubuntu 18.04 LTS server. It is the second most used web server in the world.","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:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/","og_locale":"en_US","og_type":"article","og_title":"How To Install Nginx on Ubuntu 18.04 Server - ITSupportWale","og_description":"In this tutorial, we'll learn, How to Install Nginx on Ubuntu 18.04 LTS server. It is the second most used web server in the world.","og_url":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/","og_site_name":"ITSupportWale","article_publisher":"https:\/\/www.facebook.com\/Itsupportwale-298547177495978","article_published_time":"2021-01-05T05:21:39+00:00","article_modified_time":"2023-09-19T22:00:56+00:00","og_image":[{"width":747,"height":506,"url":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg","type":"image\/jpeg"}],"author":"Techie","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Techie","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#article","isPartOf":{"@id":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/"},"author":{"name":"Techie","@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d"},"headline":"How To Install Nginx on Ubuntu 18.04 Server","datePublished":"2021-01-05T05:21:39+00:00","dateModified":"2023-09-19T22:00:56+00:00","mainEntityOfPage":{"@id":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/"},"wordCount":985,"commentCount":0,"publisher":{"@id":"https:\/\/itsupportwale.com\/blog\/#organization"},"image":{"@id":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#primaryimage"},"thumbnailUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg","keywords":["installation","nginx","nginx webserver","ubuntu","ubuntu 18.04"],"articleSection":["FOSS","Linux","Nginx","Tutorial","Tutorials","Ubuntu","Web Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/","url":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/","name":"How To Install Nginx on Ubuntu 18.04 Server - ITSupportWale","isPartOf":{"@id":"https:\/\/itsupportwale.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#primaryimage"},"image":{"@id":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#primaryimage"},"thumbnailUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg","datePublished":"2021-01-05T05:21:39+00:00","dateModified":"2023-09-19T22:00:56+00:00","description":"In this tutorial, we'll learn, How to Install Nginx on Ubuntu 18.04 LTS server. It is the second most used web server in the world.","breadcrumb":{"@id":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#primaryimage","url":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg","contentUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2020\/02\/install-nginx-on-ubuntu-18.04-1.jpg","width":747,"height":506,"caption":"install-nginx-on-ubuntu-18.04"},{"@type":"BreadcrumbList","@id":"https:\/\/itsupportwale.com\/blog\/how-to-install-nginx-on-ubuntu-18-04-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/itsupportwale.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How To Install Nginx on Ubuntu 18.04 Server"}]},{"@type":"WebSite","@id":"https:\/\/itsupportwale.com\/blog\/#website","url":"https:\/\/itsupportwale.com\/blog\/","name":"ITSupportWale","description":"Tips, Tricks, Fixed-Errors, Tutorials &amp; Guides","publisher":{"@id":"https:\/\/itsupportwale.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itsupportwale.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/itsupportwale.com\/blog\/#organization","name":"itsupportwale","url":"https:\/\/itsupportwale.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png","contentUrl":"https:\/\/itsupportwale.com\/blog\/wp-content\/uploads\/2023\/09\/cropped-Logo-trans-without-slogan.png","width":1119,"height":144,"caption":"itsupportwale"},"image":{"@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Itsupportwale-298547177495978"]},{"@type":"Person","@id":"https:\/\/itsupportwale.com\/blog\/#\/schema\/person\/8c5a2b3d36396e0a8fd91ec8242fd46d","name":"Techie","sameAs":["https:\/\/itsupportwale.com","iswblogadmin"],"url":"https:\/\/itsupportwale.com\/blog\/author\/iswblogadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/posts\/881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/comments?post=881"}],"version-history":[{"count":0,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/posts\/881\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/media\/3448"}],"wp:attachment":[{"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/media?parent=881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/categories?post=881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsupportwale.com\/blog\/wp-json\/wp\/v2\/tags?post=881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}