Configure UFW Firewall
Enable UFW and allow SSH/HTTP/HTTPS ports
Overview
Enable UFW and allow SSH/HTTP/HTTPS ports
Commands
This will enable UFW and open ports 22/80/443, continue?
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw --force enable
Use Cases
Security initialization for new servers, prevent exposure of unauthorized ports.
Prerequisites
Ensure SSH port (22) is open, otherwise remote connection will drop.
FAQ
- Cannot connect to the server after operation → recover via VNC/console
- View rules →
sudo ufw status numbered
Related Commands
- Ban IP Address
- View Listening Ports