Install NGINX on Ubuntu

Narendra NNarendra N
1 min read

Here are the general steps to install NGINX on Ubuntu:

  1. Update package lists for the most recent version:

Update the package list to ensure you have the latest information about available packages and versions.

sudo apt update
  1. Install NGINX:

Use the package manager (apt) to install NGINX

sudo apt install nginx
  1. Start and enable NGINX:

NGINX will start automatically after installation. If it doesn't, start it manually.

sudo systemctl start nginx

You can also enable NGINX to start on boot:

sudo systemctl enable nginx

Verify the installation:

Open a web browser and enter your server's IP address or domain name. If NGINX is installed correctly, you should see the default NGINX welcome page.

If the firewall is active, ensure that port 80 (HTTP) and 443 (HTTPS) are allowed for NGINX

sudo ufw allow 'Nginx HTTP'
  1. You should now be able to access the default NGINX page through a web browser.

Please ensure you have the appropriate privileges to run these commands, typically by using sudo. Additionally, adjust any steps based on specific requirements for Ubuntu 22.04 once it is officially released.

1
Subscribe to my newsletter

Read articles from Narendra N directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Narendra N
Narendra N