Nginx is a high-performance web server and reverse proxy used by millions of websites worldwide. It handles static files efficiently, serves as a load balancer, and acts as a reverse proxy for application servers. This guide installs and verifies Nginx on Ubuntu 26.04 LTS.

Tested and valid on:

  • Ubuntu 26.04 LTS

Prerequisites

  • Ubuntu 26.04 LTS server
  • A user with sudo privileges
  • UFW firewall installed

Step 1 – Update Package Index

Always refresh the package list before installing:

sudo apt update

Step 2 – Install Nginx

Install Nginx from Ubuntu’s official repositories:

sudo apt install nginx -y

Step 3 – Allow Nginx Through UFW

Allow full HTTP/HTTPS traffic:

sudo ufw allow 'Nginx Full'
sudo ufw status

Step 4 – Check Nginx Status

Nginx starts automatically after installation. Verify:

sudo systemctl status nginx

Step 5 – Test in a Browser

Open http://your_server_ip in a browser. You should see the Nginx welcome page. Or use curl:

curl -I http://localhost

Step 6 – Useful Nginx Commands

Key management commands:

sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl reload nginx   # reload config without downtime
sudo nginx -t                 # test config syntax

Step 7 – Explore Important Paths

Nginx’s key file locations:

  • Config: /etc/nginx/nginx.conf
  • Sites available: /etc/nginx/sites-available/
  • Sites enabled: /etc/nginx/sites-enabled/
  • Web root: /var/www/html/
  • Logs: /var/log/nginx/

Conclusion

Nginx is now installed and serving on Ubuntu 26.04 LTS. Next steps include configuring server blocks (virtual hosts) for your domains and securing traffic with a Let’s Encrypt SSL certificate.