Installing Nginx on a newer Ubuntu is easy. Just follow the steps below. The guide indicates version 20.04. I used it on 22.10.
If you are not aware on your exact version of Ubuntu, see my TIL: How to enquire Ubuntu version.
sudo apt update
sudo apt install nginxsudo ufw app list
Available applications:
Nginx Full
Nginx HTTP
Nginx HTTPS
OpenSSHNginx Full: This profile opens both port 80 (normal, unencrypted web traffic) and port 443 (TLS/SSL encrypted traffic)
Nginx HTTP: This profile opens only port 80 (normal, unencrypted web traffic)
Nginx HTTPS: This profile opens only port 443 (TLS/SSL encrypted traffic)
sudo ufw allow 'Nginx Full'sudo ufw status
Status: active
To Action From
-- ------ ----
Nginx HTTP ALLOW Anywhere
443 ALLOW Anywhere
Nginx HTTP (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)sudo systemctl status nginx
...Get your public IPv4 address from icanhazip.com.
curl -4 icanhazip.com
```bash
curl -6 icanhazip.comOpen the URL in your browser. You should see the default Nginx page.
curl http://<your-public-ipv4-address>