How to Install NGINX on Ubuntu 22.04

How to Install NGINX on Ubuntu 22.04

Ubuntu 20.4|22.04, Install and configure NGINX; Through this tutorial, we will show you how to install, uninstall and configure NGINX on Linux ubuntu 20.4|22.04 system using terminal or command line.

How to Install & Uninstall NGINX in Ubuntu 20.4|22.04

Use the following steps to install, configure and uninstall NGINX on linux ubuntu 20.4|22.04 using command line or terminal:

  • Step 1 – Open Terminal OR Command Line
  • Step 2 – Update APT Packages
  • Step 3 – Install NGINX on Ubuntu 20.0|22.04
  • Step 4 – Verify NGINX Installation Ubuntu
  • Step 5 – Configure Firewall For NGINX
  • Step 6 – Test Installation in Browser
  • Step 7 – Configure NGINX Server
  • Step 8 – Uninstall Nginx on Ubuntu 20.0|22.04 Linux(Optional)

Step 1 – Open Terminal OR Command Line

First of all, Open the terminal or command line application by pressing Ctrl+Alt+T.

Step 2 – Update APT Packages

Then update apt packages by using the following command:

Step 3 – Install NGINX on Ubuntu 20.0|22.04

Next, you can install NGINX on linux ubuntu 20.0|22.04 system by using the following command:

sudo apt install NGINX

Step 4 – Verify NGINX Installation Ubuntu

Once the installation of NGINX on linux ubuntu system has been done; then execute the following command on command line to verify NGINX installation:

sudo systemctl status NGINX

Step 5 – Configure Firewall For NGINX

NGINX server from various HTTP and non-HTTP web servers on port 443, 80, or both of these ports. So use the following commands to configure firewall for NGINX for linux ubuntu system:

sudo ufw allow ‘NGINX Full’

Step 6 – Test Installation in Browser

Then open web browser and hit the following url with ip address to test NGINX installation:

http://YOUR_IP

Step 7 – Configure NGINX Server

Configure NGINX server for it to restart after system reboots:

sudo systemctl enable NGINX

And use the following additional commands to check the status of the NGINX server, in addition to restarting it, reloading it, starting it, stopping it, and disabling it from starting every time the system boots up.

For NGINX Status

sudo systemctl status NGINX

For Restart NGINX

sudo systemctl restart NGINX

For Reload NGINX

sudo systemctl reload NGINX

For Start NGINX

sudo systemctl start NGINX

For Stop NGINX

sudo systemctl stop NGINX

For Disable NGINX

sudo systemctl disable NGINX

Step 8 – Uninstall Nginx on Ubuntu 20.0|22.04 Linux(Optional)

Sometimes, you may need to remove or uninstall NGINX Server in linux ubuntu system. You can do it by following commands:

sudo apt-get purge NGINX
sudo apt-get autoremove

Conclusion

Through this tutorial, we have learned how to install, uninstall and configure NGINX on Linux ubuntu 22.04 system using command line.

Recommended Linux Ubuntu Tutorials

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *