DEV Community

Omar faruk zihad
Omar faruk zihad

Posted on

Setup Nginx in a Digitalocean droplet

I will explain the procedure for configuring a Digitalocean droplet and setting up Nginx for this droplet.

Configure the Digitalocean droplet

At first, sign up on the Digitalocean platform . After going to the home page click on the Create Button in the upper side

Image description

Choose droplets

Image description
After coming to the new page, choose your datacenter closest to your main traffic. Then choose the OS, I will be doing this with Ubuntu 22.04LTS. Choose the package and sign-in method. I will be adding my SSH key here.

Install and configure Nginx

Login to the server by using your terminal. If you added your ssh key, then you can do this
ssh root@192.123.222.11

We will now install Nginx by doing

sudo apt update
sudo apt install nginx
Enter fullscreen mode Exit fullscreen mode

After completing the installation , we will configure the firewall. We will now open both port 80 and 443 by running below command

sudo ufw allow 'Nginx FULL'
Enter fullscreen mode Exit fullscreen mode

Verify it by running

sudo ufw status
Enter fullscreen mode Exit fullscreen mode

This will show

Image description

Now verify the whole Nginx installation by

systemctl status nginx
Enter fullscreen mode Exit fullscreen mode

Image description

From the web browser, enter the IP in the browser

Image description

Congrats! The nginx is installed successfully on a digitalocean droplet.

Top comments (0)