sudo apt updatesudo apt install -y nginxsudo systemctl enable --now nginxsudo ufw allow 'Nginx Full'systemctl status nginx --no-pagerOutput
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; preset: enabled)
Active: active (running)Explanation
Install Nginx and open ports 80 and 443 in the firewall (1-installation tab).
Create the site configuration in
/etc/nginx/sites-available/: site folder, domain name and security headers (highlighted lines).Enable the site, test the configuration with
nginx -tthen reload Nginx. Never reload without testing: a syntax error would take all your sites down.Switch to HTTPS with Certbot: the Let's Encrypt certificate is free and renews automatically.
Before running Certbot, the domain name must already point to the server's IP address (DNS A and AAAA records).

