Install Nginx on Ubuntu

nginx

Updated August 29, 2026

Install Nginx from Ubuntu's repositories when the distribution version meets your needs:

sudo apt update
sudo apt install nginx
sudo systemctl enable --now nginx
sudo nginx -t

Open http://server-address/ from a permitted network and confirm that the default page responds. The main configuration is commonly /etc/nginx/nginx.conf, with site files under /etc/nginx/sites-available and symlinks in sites-enabled, but inspect the package layout on your release.

Before exposing a site, replace the default server block with a deliberate server_name, root, index policy, and security headers appropriate for the application. Obtain TLS through a current certificate workflow such as Certbot/Let's Encrypt or your hosting platform, and redirect HTTP only after HTTPS works. Keep the firewall and upstream service restricted; an installed web server is not automatically a secure deployment.

Sources

related.

Ruslan Osipov

Ruslan Osipov

About the author