Firewall configuration using UFW (Uncomplicated Firewall)
2023-09-06 18:02:56
IT
Installing UFW (If Not Installed)
First, if UFW is not installed, use the following commands to install it:
sudo apt update
sudo apt install ufw
Activating UFW
Next, activate UFW:
sudo ufw enable
Opening Necessary Ports
Typically, open ports 80 and 443 for HTTP and HTTPS, respectively. Port 22 is also commonly opened for SSH access.
sudo ufw allow 22,80,443/tcp
Adding Rules for Nginx
You can also use a profile for Nginx:
sudo ufw allow 'Nginx Full'
Checking UFW Settings
Confirm that the settings have been applied correctly.