How to install NGINX on Ubuntu 22.04 Terminal?

By Hardik Savani May 1, 2024 Category : Ubuntu

Hello Developer,

In this article, we'll provide you with a step-by-step guide on how to install NGINX on Ubuntu 22.04. This guide will not only show you how to install NGINX but also cover the installation of PHP and MySQL on Ubuntu 22.04. You'll also find the necessary commands to install NGINX on Ubuntu 22.04. Follow the example below to install NGINX version 1.22 on Ubuntu 22.04.

To install NGINX on Ubuntu 22.04, you can follow these step-by-step instructions:

Step 1: Update Package Lists

Before installing any new software, it's a good practice to update your package lists to ensure you are getting the latest available packages. Open your terminal and run the following command:

sudo apt update

Step 2: Install NGINX

After updating the package lists, you can install NGINX by running the following command:

sudo apt install nginx

Step 3: Start and Enable NGINX

Once the installation is complete, start NGINX and enable it to start automatically at boot:

sudo systemctl start nginx

sudo systemctl enable nginx

Step 4: Verify NGINX Installation

You can check whether NGINX is running properly by entering the following command:

sudo systemctl status nginx

You should see output indicating that NGINX is active and running.

Step 5: Configure Firewall

If you have the UFW (Uncomplicated Firewall) enabled on your system, you'll need to allow HTTP (port 80) and HTTPS (port 443) traffic. If you don't have UFW installed, you can install it with `sudo apt install ufw`. Then, enable the necessary ports:

sudo ufw allow 'Nginx HTTP'

sudo ufw allow 'Nginx HTTPS'

Step 6: Verify NGINX in Your Browser

Open your web browser and enter your server's IP address or domain name. You should see the default NGINX welcome page, indicating a successful installation.

That's it! NGINX is now installed and running on your Ubuntu 22.04 server. You can proceed to configure NGINX to serve your websites or web applications as needed.

I hope it can help you...

Tags :
Shares