By default, ports are blocked for incomming requests
1) Enable ufw
sudo ufw enable
2) Add port
sudo ufw allow http (or) sudo ufw allow 80/tcp sudo ufw allow ssh (or) sudo ufw allow 223) Deny port
sudo ufw deny http4) List all open ports
sudo ufw status
To Action From
-- ------ ----
22 ALLOW Anywhere
80 ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
Suppose we have a nginx server listening on port 80, we can check it with teh following command
sudo netstat -ntlp | grep :80