Announcement

Collapse
No announcement yet.

How to Install Nginx on Ubuntu 24.04

Collapse
X
Collapse
  •  

  • How to Install Nginx on Ubuntu 24.04


    Nginx stands out for its higher performance and scalability among the available web servers. Nginx is open-source, and you can use it for different activities on your Linux system. In Ubuntu 24.04, you can install Nginx by sourcing it from the default repository. Once installed, configure your firewall and start using Nginx. This post shares the details of every step you should take. Read on!
    Step-by-Step Guide to Install Nginx on Ubuntu 24.04

    To install Nginx, ensure you have access to your system with sudo privileges and access to the terminal. With that, the steps below will guide you through everything you should do to install and configure your firewall to start using Nginx. Follow along!

    Step 1: Update the Repository

    in Ubuntu 24.04, Nginx is available in its default repository. As such, you won’t have to add its repository. Before installing this Nginx version, let’s ensure we get the latest version by updating the package index.

    $ sudo apt update




    Step 2: Install Nginx via APT

    After refreshing the Ubuntu repository, execute the install command below to fetch and install the Nginx package. Ensure you confirm the prompt.

    $ sudo apt install nginx




    Confirm that Nginx has been installed by running the below command to display the installed version.

    $ nginx -version




    We’ve installed Nginx 1.24.0.

    Step 3: Enable and Start the Nginx Service

    Before we can use Nginx, we must start the Nginx service. Instead of starting it every time you want to use it, setting Nginx to start at boot time is better. To do so, enable the Nginx service and restart Nginx using the commands below.

    $ sudo systemctl enable nginx

    $ sudo systemctl restart nginx




    Next, check the Nginx service to ensure that it’s active (running).

    $ sudo systemctl status nginx




    Step 4: Configure the Firewall

    Although the firewall automatically detects Nginx and allows its connection, we must ensure it registers it. You can also specify a different rule to use with Nginx.

    For this guide, we don’t want to give Nginx full access. Instead, let’s specify that we only want to connect via HTTP. To save this configuration, execute the following command.

    $ sudo ufw allow ‘Nginx HTTP’




    You can also give it HTTPS access, or if you want to allow HTTP and HTTPS, create a Nginx Full rule.

    With our rule added successfully, let’s view the firewall status to verify further that we have our rule added correctly. Check the firewall status using the command below.

    $ sudo ufw status




    Step 5: Verify Nginx Works

    A quick way of confirming that your Nginx installation was a success is by opening the Nginx landing page. You can do this in two ways. The first option involves opening your web browser and accessing your web page. For instance, if using localhost, we would open the site: http://localhost

    You will get an Nginx welcome page confirming that Nginx is all set and ready for use.



    Alternatively, you can visit the same web page using curl and check the output. If the output shows the same welcome message, your installation was successful.

    $ curl 127.0.0.1




    Conclusion

    Nginx is an open-source web server that can be installed and used on Ubuntu 24.04. The Nginx package is available from the Ubuntu repository. To install it, use APT. Next, configure your firewall to allow traffic via Nginx. We’ve discussed each step, and with this guide as a reference, you can install Nginx on Ubuntu 24.04.





    More...
      Posting comments is disabled.

    Categories

    Collapse

    Article Tags

    Collapse

    There are no tags yet.

    Latest Articles

    Collapse

    • How to Change Your Prompt in Bash Shell in Ubuntu
      by Kasimba
      I don’t like my prompt, i want to change it. it has my username and host, but the formatting is not what i want. This blog will get you started quickly on doing exactly that.
      This is my current prompt below:



      To change the prompt you will update .bashrc and set the PS1 environment variable to a new value.

      Here is a cheatsheet of the prompt options:

      You can use these placeholders for customization:

      \u – Username

      ...
      Today, 01:15 AM
    • How to Install ZSH shell on Rocky Linux
      by Kasimba
      In this post I will show you how to install the ZSH shell on Rocky Linux. ZSH is an alternate shell that some people prefer instead of BASH shell. Some people say ZSH has better auto-completion, theme support, and plugin system. If you want to give ZSH a try its quite easy to install and give it a try. This post is focused on the Rocky Linux user and how to install ZSH and get started with its usage.
      Before installing anything new, it’s good practice to update your system packages:...
      12-25-2024, 02:01 AM
    • 5 Compelling Reasons to Choose Linux Over Windows
      by Kasimba



      by George Whittaker


      Introduction

      In the world of operating systems, Windows has long held the lion’s share of the market. Its user-friendly interface and wide compatibility have made it the default choice for many. However, in recent years, Linux has steadily gained traction, challenging the status quo with its unique offerings. What was once considered the domain of tech enthusiasts and developers is now...
      12-21-2024, 06:52 AM
    • NGINX vs Apache; Web Server Comparison
      by Kasimba
      Overview of NGINX and Apache

      NGINX and Apache are leading web server solutions utilized for hosting websites and web applications. Apache, developed by the Apache Software Foundation, offers robust configuration options and extensibility. NGINX, created by Igor Sysoev, is known for its efficiency in handling numerous concurrent connections with low resource utilization. Both servers function not only as HTTP servers but also as reverse proxies, load balancers, and more.

      What is

      ...
      12-21-2024, 03:54 AM
    • Monthly News – November 2024
      by Kasimba
      Hi everyone, I hope you are enjoying the BETA so far! This release introduces new features, tools, and artwork, so we anticipate a good number of bug reports. Every single fix helps us refine and improve the final release. Your feedback during the BETA phase is extremely important to us. Linux Mint 22.1 is our […]

      More...
      12-16-2024, 11:50 AM
    • Mastering OpenSSH for Remote Access on Debian Like a Pro
      by Kasimba



      by George Whittaker


      Introduction

      Remote access is a cornerstone of modern IT infrastructure, enabling administrators and users to manage systems, applications, and data from virtually anywhere. However, with great power comes great responsibility—ensuring that remote access remains secure is paramount. This is where OpenSSH steps in, providing robust, encrypted communication for secure remote management....
      12-13-2024, 10:31 PM
    Working...
    X