iptables -A INPUT -p tcp --dport 80,443 -j ACCEPT

Category: Security & Hardening

iptables -A INPUT -p tcp --dport 80,443 -j ACCEPT

Allow web traffic on ports 80 and 443

Accepts TCP connections to both HTTP (80) and HTTPS (443) with one rule, thanks to the comma-separated port list. This covers a typical web server's inbound traffic. Add the conntrack state rule first so replies flow back.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.