All snippets
bashApril 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.
Full walkthrough (screenshots and explanations): How to install and configure Nginx on your Linux server.
bash
# 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
sudo ufw app list
sudo ufw allow 'Nginx Full'
sudo ufw status verbose
# Default layout (reference, not executed)
# Main config: /etc/nginx/nginx.conf
# Site configs: /etc/nginx/sites-available/ → symlinked in sites-enabled/
# Default web root: /var/www/html/