sudo ufw allow proto tcp to any port 80,443 comment 'web traffic'

Category: VPS Management

sudo ufw allow proto tcp to any port 80,443 comment 'web traffic'

Allow HTTP and HTTPS on one rule with comment

One rule opens both web ports: the comma-separated list expands to 80 and 443, and proto tcp restricts it to TCP so UDP traffic stays blocked. The comment flag labels the rule for later audits and shows up in ufw status. Delete the whole list later with ufw delete followed by its number from ufw status numbered.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.