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

Popular posts from this blog

Use CS50 Library in Your Local Machine Offline (C Language Setup)

Use CS50 Library in Your Local Machine Offline (C Language Setup) Make Your PC Ready for C Programming with CS50 In this guide, you will learn how to prepare your computer to run C programs locally and use the CS50 library offline. The following videos will walk you through all required tools and setup steps. Step 1: Install Visual Studio Code This video explains how to download and install Visual Studio Code on Windows 10. Step 2: Install C/C++ Compiler (GCC, G++, GDB) Learn how to install the C/C++ toolchain using MinGW-w64 and MSYS2. Step 3: Configure VS Code for C/C++ This step shows how to properly configure Visual Studio Code for C and C++ programming. How to Use CS50 Library Offline After completing the setup above, follow these steps to use the CS50 library locally without internet access: Download the CS50 library from GitHub Releases: https://github.com/cs50/libcs50/rel...

Install Windows 11 on a bootable USB using Linux

 Install Windows 11 on a bootable USB using Linux 1 Download the iso image of Windows from the offical website for Microsoft 2 Open terminal and run these commands to install WoeUSB sudo add-apt-repository ppa:tomtomtom/woeusb sudo apt update sudo apt install woeusb 3 Plugin the USB into the device, and run this command lsblk Assume your USB is /dev/sdb 4 Format it to NTFS or FAT32: sudo mkfs.ntfs -f /dev/sdb # or sudo mkfs.vfat -F 32 /dev/sdb 5 Unmount the USB sudo umount /dev/sdb* 6 Burn the ISO file into the USB sudo woeusb --device /path/to/windows.iso /dev/sdb 7 Remove the USB if the files are burned successfuly and it can be used as bootable to install Windows.