Snippets
Code that
just works.
Small, focused code snippets with real-world context. Useful patterns, one-liners, and hooks that have survived production. Copy and adapt freely.
bashApr 26, 2026
Nginx on Ubuntu — install and firewall commands
Copy-paste only: update packages, install Nginx, open UFW for Nginx, check status and reload. Pairs with the full walkthrough post.
# Packages and service
sudo apt-get update && sudo apt-get upgrade
sudo apt install nginx
sudo systemctl status nginx
sudo systemctl reload nginx # after config edits (e.g. new server blocks)
# Firewall (Ubuntu UFW) — "Nginx Full" = ports 80 + 443