> For the complete documentation index, see [llms.txt](https://docs.neevcloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.neevcloud.com/neevcloud-guide/neevcloud-knowledgebase/how-to-install-nginx-on-ubuntu-22.04.md).

# How to Install Nginx on Ubuntu 22.04

In this guide, we will walk you through how to install Nginx on Ubuntu 22.04, enabling you to set up a powerful web server for your applications and websites.

Nginx is an open-source web server that serves as a reverse proxy, load balancer, and HTTP cache. It's known for its high performance: stability, rich feature sets, and low resource consumption.

{% embed url="<https://youtu.be/DXK1S2NmfIs?si=9Wc05TxAh8Kl6kP0>" %}

This article explains how to install the Nginx web server on Ubuntu 22.04.

## Prerequisites

* Launch the [Ubuntu 22.04 instance](https://docs.neevcloud.com/neevcloud-products/computes/getting-started-launch-vms) on Neevcloud&#x20;
* Create a new Domain or subdomain A record that points to your server IP address.
* Access the server using [SSH](https://docs.neevcloud.com/neevcloud-products/computes/getting-started-launch-vms#ssh)

Let's follow step by step for a complete Nginx installation and basic configuration on Ubuntu 22.04.

## Update && Upgrade the system

First, ensure your package list is up to date to avoid any issues with outdated packages

```
sudo apt-get update -y
sudo apt-get upgrade -y
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2Fd84M2rY95ky10jR7iHXc%2Fimage.png?alt=media&amp;token=65804dec-0da8-49fb-a369-c8349456dcfb" alt=""><figcaption></figcaption></figure>

## Install Nginx

Use the apt command to install the nginx service.

```
sudo apt-get install nginx -y
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2FHcOAnrk1FftZx99frNSx%2Fimage.png?alt=media&amp;token=069448da-7847-4d5b-85b0-5995f64d2110" alt=""><figcaption></figcaption></figure>

### Start and Enable Nginx

Once the Nginx is installed, start the Nginx service

```
sudo systemctl start nginx
```

Enable it to start when the system rebooted

```
sudo systemctl enable nginx
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2FQKbviiwcqmantRKHpfpo%2Fimage.png?alt=media&amp;token=7faa4337-66ff-4258-8493-871d0f43ee39" alt=""><figcaption></figcaption></figure>

### Check the Status

Ensure Nginx is running smoothly.

```
sudo systemctl status nginx
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2FzeyKz4Cj2nhGwXQt5AIN%2Fimage.png?alt=media&amp;token=60a6c1ba-fda2-475c-b0aa-1cb24d0830b1" alt=""><figcaption></figcaption></figure>

### **Check nginx default port**

To verify that **Nginx** is running on its default **port (80)**, execute the command below

```
sudo ss -antpl | grep nginx
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2FfpId8UhglLPFUNRvyxxY%2Fimage.png?alt=media&amp;token=ce242790-1f02-450a-b043-298123690ce9" alt=""><figcaption></figcaption></figure>

### Adjusting The Firewall

To configure `ufw` to allow Nginx connections, it's important to find a balance between security and traffic requirements. You must allow HTTP traffic if your server isn't set up with SSL. To do this, enable connections on the port

```
sudo ufw allow 'Nginx HTTP'
sudo ufw enable
sudo ufw status 
```

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2Fgab0rWkEzjdv9fJurlEt%2Fimage.png?alt=media&amp;token=50e19b86-c294-4648-aebe-068f82a0fcbe" alt=""><figcaption></figcaption></figure>

### Test Nginx

To verify your Nginx installation, navigate to `http://your-server-ip` your web browser. If the installation is successful, you will be greeted by the Nginx test page.

{% embed url="<http://your-server-ip>" %}

You should see the default Nginx welcome page.

<figure><img src="https://1876135298-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FEC5NwtFshv6EATOemuUn%2Fuploads%2FW2daFZir2vM7cyPWRM1a%2Fimage.avif?alt=media&amp;token=185f6498-6e61-4bbf-a2a0-97771c0b6efe" alt=""><figcaption></figcaption></figure>
