After creating a new compute instance in oracle cloud with ubuntu as the os, I installed nginx.
Now to open port 80 I tried the commands sudo ufw allow 'Nginx HTTP'
and enabled ufw. But still I couldn't access the server on port 80 from the browser. However, if I use the command sudo iptables -I INPUT -p tcp --dport 80 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
, I can access the server on port 80. To make sure this is the case, I recreated new compute instances and tried this out multiple times.
From what I understand ufw serves as a simpler interface to the much more complicated iptables.
Is there an explanation as to why this works like this? `
sudo ufw allow http
instead of requiring 'nginx http' - 'http' is the more generic port 80 and usually works properly. Also, DO NOT mixufw
and straightiptables
commands - use one or the other.