Nginx Install
Techno Sensei 4 months ago

How To Install Nginx on Ubuntu 22.04

Nginx is a popular open-source web server that is known for its high performance and stability. In this tutorial, we will show you how to install Nginx on an Ubuntu 22.04 LTS system.

Before we begin, we assume you have created the VPS with Ubuntu OS v22.04

Step 1 - Update System

Make sure that your system is up-to-date by running the following commands:

sudo apt update
sudo apt upgrade


Step 2 - Install Nginx

Next, we'll install Nginx using the apt package manager:

sudo apt install nginx

Now insert nginx into firewall

sudo ufw allow 'Nginx HTTP'

By default, Nginx listens on port 80, and now put port 80 for http and port 443 for https into firewall

sudo ufw allow 443/tcp
sudo ufw allow 80/tcp

(optional) And if you want control your server with ssh, don't forget put 'OpenSSH' to firewall to

sudo ufw allow 'OpenSSH' 

Verified the changes by:

sudo ufw status

The output:

Output
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere                  
Nginx HTTP                 ALLOW       Anywhere                  
OpenSSH (v6)               ALLOW       Anywhere (v6)             
Nginx HTTP (v6)            ALLOW       Anywhere (v6)

Enable the firewall to complete the process (if the firewall have enabled it won't be affect anything)

sudo ufw enable

(optional) Install the curl if need it

sudo apt-get install curl

After the installation is complete, you can check the status of the Nginx service by running:

systemctl status nginx

The output should indicate that the service is running:

nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset:>
     Active: active (running) since Sun 2023-01-08 02:51:48 UTC; 3 days ago
       Docs: man:nginx(8)
   Main PID: 2504 (nginx)
      Tasks: 2 (limit: 1131)
     Memory: 5.5M
     CGroup: /system.slice/nginx.service
             ├─2504 nginx: master process /usr/sbin/nginx -g daemon on; master_>
             └─2507 nginx: worker process

To test that Nginx is working properly, open a web browser and navigate to http://localhost or your server ip address. You should see the Nginx default welcome page, which confirms that the web server is up and running.

If you want to change the default page just go to this directory:

/var/www/html

You can remove the default file inside html folder and create a new file or put your website file to this directory and navigate to it in your web browser to see it displayed.

Nginx is now installed and running on your Ubuntu system. You can now proceed to configure and customize it to suit your needs.

In conclusion, is an easy process to install and start using Nginx on an Ubuntu system, you can take advantage of the many performance and security features that Nginx has to offer and configure it to fit your needs.



0
206
How To Install MySQL on Ubuntu 22.04

How To Install MySQL on Ubuntu 22.04

1674143770.png
Techno Sensei
4 months ago
What To Do When Your Smartphone Falls into Water

What To Do When Your Smartphone Falls into Water

1676196989.jpg
JAFAR
3 months ago
Netflix plans how to stop password sharing outside family

Netflix plans how to stop password sharing outside family

1674143770.png
Techno Sensei
4 months ago
Iphone 14 pro review

Iphone 14 pro review

1674143770.png
Techno Sensei
5 months ago
DJI Avata Review | Should you buy it?

DJI Avata Review | Should you buy it?

1674143770.png
Techno Sensei
5 months ago