Skip to main content

How to Open Port 80 and 443 in FirewallD (HTTP & HTTPS Guide)

How to Open Port 80 and 443 in FirewallD (HTTP & HTTPS Guide)

If you're running a web server on Linux, you need to open port 80 (HTTP) and port 443 (HTTPS) in your firewall to allow incoming traffic.

This guide shows how to open ports in FirewallD using simple commands.


🚀 Allow Port 80 & 443 in FirewallD

Use the following commands to allow HTTP and HTTPS traffic:

sudo firewall-cmd --zone=public --add-port=80/tcp
sudo firewall-cmd --zone=public --add-port=443/tcp

These rules are temporary and will be removed after a reboot.

Make Rules Permanent

sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
sudo firewall-cmd --permanent --zone=public --add-port=443/tcp

Reload FirewallD to apply changes:

sudo firewall-cmd --reload

🔍 Verify Open Ports

Check if ports 80 and 443 are open:

sudo firewall-cmd --permanent --zone=public --list-ports

Expected output:

80/tcp 443/tcp

❌ Remove Ports from FirewallD

If you want to close the ports:

sudo firewall-cmd --permanent --zone=public --remove-port=80/tcp
sudo firewall-cmd --permanent --zone=public --remove-port=443/tcp

Reload firewall:

sudo firewall-cmd --reload

💡 Notes

  • Port 80 is used for HTTP traffic.
  • Port 443 is used for HTTPS (secure connections).
  • Always use --permanent for production servers.

🔗 Related Guides

  • Check if a port is open in Linux
  • Kill a process running on a specific port

📚 Source: tecadmin.net

Comments