Hero Image

Install Nginx on Ubuntu 24.04

Install Nginx on Ubuntu 24.04

This guide walks through installing and starting Nginx on Ubuntu 24.04.

Step 1 – Update package lists

apt update && apt upgrade -y

Step 2 – Install Nginx

apt install -y nginx

Step 3 – Start and enable Nginx

systemctl enable --now nginx

Step 4 – Allow HTTP and HTTPS through UFW

ufw allow 'Nginx Full'
ufw reload

Step 5 – Verify

nginx -v
curl -I http://localhost

Configuration lives in /etc/nginx/nginx.conf; virtual-host files go in /etc/nginx/sites-available/ and are activated with a symlink to /etc/nginx/sites-enabled/.

Next steps