{"id":13924,"date":"2024-05-29T13:28:19","date_gmt":"2024-05-29T10:28:19","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=13924"},"modified":"2024-05-29T13:28:21","modified_gmt":"2024-05-29T10:28:21","slug":"how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/","title":{"rendered":"How To Install Nginx Webserver On Ubuntu 24.04 Noble Numbat"},"content":{"rendered":"\n

Nginx is a powerful, high-performance web server used for serving static files, load balancing, and reverse proxying. It is known for its stability, rich feature set, simple configuration, and low resource consumption. In this guide, we’ll walk you through the steps to install Nginx on Ubuntu<\/a> 24.04 Noble Numbat.<\/p>\n\n\n\n

Step 1: Update Your Package List<\/h2>\n\n\n\n

Before installing Nginx<\/a>, it’s important to update your package list to ensure you have the latest information on the available packages. Open your terminal and run:<\/p>\n\n\n\n

$ sudo apt update<\/code><\/pre>\n\n\n\n

This command will update your local package index.<\/p>\n\n\n\n

Step 2: Install Nginx<\/h2>\n\n\n\n

Once your package list is updated, you can install Nginx by running:<\/p>\n\n\n\n

$ sudo apt install nginx<\/code><\/pre>\n\n\n\n

You may be prompted to confirm the installation. Type Y<\/code> and press Enter to proceed.<\/p>\n\n\n\n

Step 3: Start and Enable Nginx<\/h2>\n\n\n\n

After the installation is complete, you need to start the Nginx service and enable it to start on boot:<\/p>\n\n\n\n

$ sudo systemctl start nginx\n$ sudo systemctl enable nginx<\/code><\/pre>\n\n\n\n

To verify that Nginx is running, you can check its status:<\/p>\n\n\n\n

$ sudo systemctl status nginx<\/code><\/pre>\n\n\n\n

You should see output indicating that the Nginx service is active and running.<\/p>\n\n\n\n

Step 4: Adjust Firewall Settings<\/h2>\n\n\n\n

If you have a firewall running on your Ubuntu system, you need to allow traffic on HTTP (port 80) and HTTPS (port 443). Use the following commands to allow Nginx traffic:<\/p>\n\n\n\n

$ sudo ufw allow 'Nginx HTTP'\n$ sudo ufw allow 'Nginx HTTPS'<\/code><\/pre>\n\n\n\n

To check the status of your firewall and confirm that the rules have been added, run:<\/p>\n\n\n\n

$ sudo ufw status<\/code><\/pre>\n\n\n\n

Step 5: Verify Nginx Installation<\/h2>\n\n\n\n

To verify that Nginx is installed and running correctly, open your web browser and enter your server’s IP address:<\/p>\n\n\n\n

http:\/\/your_server_ip<\/code><\/pre>\n\n\n\n

You should see the default Nginx welcome page, which confirms that Nginx is working correctly.<\/p>\n\n\n\n

Step 6: Basic Nginx Configuration<\/h2>\n\n\n\n

The main Nginx configuration file is located at \/etc\/nginx\/nginx.conf<\/code>, and site-specific configurations are stored in the \/etc\/nginx\/sites-available\/<\/code> directory. To enable a site, create a symbolic link to it in the \/etc\/nginx\/sites-enabled\/<\/code> directory.<\/p>\n\n\n\n

Creating a New Server Block<\/h3>\n\n\n\n

To set up a new website, you need to create a new server block file. For example, to create a new server block for example.com<\/code>:<\/p>\n\n\n\n

    \n
  1. Create the configuration file:<\/li>\n<\/ol>\n\n\n\n
    $ sudo nano \/etc\/nginx\/sites-available\/example.com<\/code><\/pre>\n\n\n\n
      \n
    1. Add the following configuration to the file:<\/li>\n<\/ol>\n\n\n\n
      server {\n    listen 80;\n    server_name example.com www.example.com;\n\n    root \/var\/www\/example.com\/html;\n    index index.html index.htm index.nginx-debian.html;\n\n    location \/ {\n        try_files $uri $uri\/ =404;\n    }\n}<\/code><\/pre>\n\n\n\n
        \n
      1. Save and close the file.<\/li>\n\n\n\n
      2. Create the document root directory:<\/li>\n<\/ol>\n\n\n\n
        $ sudo mkdir -p \/var\/www\/example.com\/html<\/code><\/pre>\n\n\n\n
          \n
        1. Set the correct permissions:<\/li>\n<\/ol>\n\n\n\n
          $ sudo chown -R $USER:$USER \/var\/www\/example.com\/html\n$ sudo chmod -R 755 \/var\/www\/example.com<\/code><\/pre>\n\n\n\n
            \n
          1. Create a sample index.html file:<\/li>\n<\/ol>\n\n\n\n
            $ nano \/var\/www\/example.com\/html\/index.html<\/code><\/pre>\n\n\n\n

            Add the following content to the file:<\/p>\n\n\n\n

            <!DOCTYPE html>\n<html>\n<head>\n    <title>Welcome to example.com!<\/title>\n<\/head>\n<body>\n    <h1>Success! The example.com server block is working!<\/h1>\n<\/body>\n<\/html><\/code><\/pre>\n\n\n\n

            Save and close the file.<\/p>\n\n\n\n

              \n
            1. Enable the server block by creating a symbolic link:<\/li>\n<\/ol>\n\n\n\n
              $ sudo ln -s \/etc\/nginx\/sites-available\/example.com \/etc\/nginx\/sites-enabled\/<\/code><\/pre>\n\n\n\n
                \n
              1. Test the Nginx configuration for syntax errors:<\/li>\n<\/ol>\n\n\n\n
                $ sudo nginx -t<\/code><\/pre>\n\n\n\n
                  \n
                1. Reload Nginx to apply the changes:<\/li>\n<\/ol>\n\n\n\n
                  $ sudo systemctl reload nginx<\/code><\/pre>\n\n\n\n

                  Conclusion<\/h2>\n\n\n\n

                  You have successfully installed and configured the Nginx web server on your Ubuntu 24.04 Noble Numbat system. You can now deploy your websites and applications using Nginx.<\/p>\n","protected":false},"excerpt":{"rendered":"

                  Nginx is a powerful, high-performance web server used for serving static files, load balancing, and reverse proxying. It is known for its stability, rich feature set, simple configuration, and low…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,28,16,18],"tags":[350,400,424,433,449,531,591,635,636],"yoast_head":"\nHow To Install Nginx Webserver On Ubuntu 24.04 Noble Numbat<\/title>\n<meta name=\"description\" content=\"In this guide, we'll walk you through the steps to install Nginx webserver on Ubuntu 24.04 Noble Numbat Linux system\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/\" \/>\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 Webserver On Ubuntu 24.04 Noble Numbat\" \/>\n<meta property=\"og:description\" content=\"In this guide, we'll walk you through the steps to install Nginx webserver on Ubuntu 24.04 Noble Numbat Linux system\" \/>\n<meta property=\"og:url\" content=\"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/\" \/>\n<meta property=\"og:site_name\" content=\"Brightwhiz.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/brightwhiz\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-05-29T10:28:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-29T10:28:21+00:00\" \/>\n<meta name=\"author\" content=\"Michael Bright\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:site\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Bright\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. 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\":\"Article\",\"@id\":\"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/\"},\"author\":{\"name\":\"Michael Bright\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\"},\"headline\":\"How To Install Nginx Webserver On Ubuntu 24.04 Noble Numbat\",\"datePublished\":\"2024-05-29T10:28:19+00:00\",\"dateModified\":\"2024-05-29T10:28:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/\"},\"wordCount\":417,\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"keywords\":[\"Libraries\",\"Nginx\",\"Open Source\",\"Optimization\",\"Performance\",\"Server\",\"Tools\",\"Web\",\"Web Applications\"],\"articleSection\":[\"Articles\",\"Guides\",\"How To\",\"Software\",\"Technology\",\"Tools\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/\",\"url\":\"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/\",\"name\":\"How To Install Nginx Webserver On Ubuntu 24.04 Noble Numbat\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/#website\"},\"datePublished\":\"2024-05-29T10:28:19+00:00\",\"dateModified\":\"2024-05-29T10:28:21+00:00\",\"description\":\"In this guide, we'll walk you through the steps to install Nginx webserver on Ubuntu 24.04 Noble Numbat Linux system\",\"breadcrumb\":{\"@id\":\"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/local.brightwhiz\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Install Nginx Webserver On Ubuntu 24.04 Noble Numbat\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/local.brightwhiz\/#website\",\"url\":\"http:\/\/local.brightwhiz\/\",\"name\":\"Brightwhiz.com\",\"description\":\"Best Tech guides, Tutorials, and News\",\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/local.brightwhiz\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/local.brightwhiz\/#organization\",\"name\":\"Brightwhiz\",\"url\":\"http:\/\/local.brightwhiz\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"width\":706,\"height\":135,\"caption\":\"Brightwhiz\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/brightwhiz\/\",\"https:\/\/x.com\/brightwhizmag\",\"https:\/\/instagram.com\/bright_whiz\/\",\"https:\/\/www.pinterest.com\/sobbayi\/\",\"https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\",\"name\":\"Michael Bright\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"caption\":\"Michael Bright\"},\"sameAs\":[\"https:\/\/sobbayi.com\"],\"url\":\"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Install Nginx Webserver On Ubuntu 24.04 Noble Numbat","description":"In this guide, we'll walk you through the steps to install Nginx webserver on Ubuntu 24.04 Noble Numbat Linux system","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":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/","og_locale":"en_US","og_type":"article","og_title":"How To Install Nginx Webserver On Ubuntu 24.04 Noble Numbat","og_description":"In this guide, we'll walk you through the steps to install Nginx webserver on Ubuntu 24.04 Noble Numbat Linux system","og_url":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/","og_site_name":"Brightwhiz.com","article_publisher":"https:\/\/www.facebook.com\/brightwhiz\/","article_published_time":"2024-05-29T10:28:19+00:00","article_modified_time":"2024-05-29T10:28:21+00:00","author":"Michael Bright","twitter_card":"summary_large_image","twitter_creator":"@brightwhizmag","twitter_site":"@brightwhizmag","twitter_misc":{"Written by":"Michael Bright","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/#article","isPartOf":{"@id":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/"},"author":{"name":"Michael Bright","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32"},"headline":"How To Install Nginx Webserver On Ubuntu 24.04 Noble Numbat","datePublished":"2024-05-29T10:28:19+00:00","dateModified":"2024-05-29T10:28:21+00:00","mainEntityOfPage":{"@id":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/"},"wordCount":417,"publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"keywords":["Libraries","Nginx","Open Source","Optimization","Performance","Server","Tools","Web","Web Applications"],"articleSection":["Articles","Guides","How To","Software","Technology","Tools"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/","url":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/","name":"How To Install Nginx Webserver On Ubuntu 24.04 Noble Numbat","isPartOf":{"@id":"http:\/\/local.brightwhiz\/#website"},"datePublished":"2024-05-29T10:28:19+00:00","dateModified":"2024-05-29T10:28:21+00:00","description":"In this guide, we'll walk you through the steps to install Nginx webserver on Ubuntu 24.04 Noble Numbat Linux system","breadcrumb":{"@id":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/local.brightwhiz\/how-to-install-nginx-webserver-on-ubuntu-24-04-noble-numbat\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/local.brightwhiz\/"},{"@type":"ListItem","position":2,"name":"How To Install Nginx Webserver On Ubuntu 24.04 Noble Numbat"}]},{"@type":"WebSite","@id":"http:\/\/local.brightwhiz\/#website","url":"http:\/\/local.brightwhiz\/","name":"Brightwhiz.com","description":"Best Tech guides, Tutorials, and News","publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/local.brightwhiz\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/local.brightwhiz\/#organization","name":"Brightwhiz","url":"http:\/\/local.brightwhiz\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","width":706,"height":135,"caption":"Brightwhiz"},"image":{"@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/brightwhiz\/","https:\/\/x.com\/brightwhizmag","https:\/\/instagram.com\/bright_whiz\/","https:\/\/www.pinterest.com\/sobbayi\/","https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ"]},{"@type":"Person","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32","name":"Michael Bright","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","caption":"Michael Bright"},"sameAs":["https:\/\/sobbayi.com"],"url":"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/"}]}},"_links":{"self":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/13924"}],"collection":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/comments?post=13924"}],"version-history":[{"count":2,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/13924\/revisions"}],"predecessor-version":[{"id":13949,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/13924\/revisions\/13949"}],"wp:attachment":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media?parent=13924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/categories?post=13924"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/tags?post=13924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}