Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  VPS FAQ  >  AlmaLinux / Rocky Linux 8 Open HTTP/HTTPS Port 80/443 with Firewalld
Top Scroll

AlmaLinux / Rocky Linux 8 Open HTTP/HTTPS Port 80/443 with Firewalld

 3 min

Rocky Linux and AlmaLinux are two major CentOS alternatives known for their security, stability, and compatibility with the enterprise environment. These distributions offer a robust platform for web hosting, application deployment, and other server needs. In the server administration, managing network traffic is a critical aspect of server administration. Hence, opening HTTP (port 80) and HTTPS (port) is the foundational step for enabling web services. 

Firewalls such as firewalld and iptables play an important role in securing your Linux system. They filter the traffic, and, therefore, secure your network. Configuring firewalls to allow traffic in or out of ports 80 and 443 allows your server to host websites and applications over secure and non-secure protocols. Here is a detailed guide on opening ports 80 and 443 in AlmaLinux and Rocky Linux 8 using firewall tools.

FirewallD is the default firewall application in Linux. You can use the following command to get this on your server.

sudo dnf install firewalld
sudo systemctl start firewalld
sudo systemctl enable firewalld
sudo systemctl status firewalld

Key Insights

  • How to open HTTP port 80 and HTTPS port 443 Permanently
  • Command to open or close any server and port in AlmaLinux

Commands to open or close HTTP port 80 & HTTPS 443 on AlmaLinux/ Rocky 8

The first step is to check the Active AlmaLinux port list. Check what ports and services already allow to communicate outside the public network in our firewall. For that use: 

sudo firewall-cmd --list-all

or

netstat -na | grep port-number

Replace port-number with the one you want to know. In the case of inactivity, you may not receive any results.

Second, you need to execute the command to open port 80 and 443. We all know that firewall comes with some default pre-configured services and http and https are in them. So, use the service or port command of the firewalld allowing to access in the Public zone: 

sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --zone=public --permanent --add-service=https

We can also open other ports if your Apache web server’s application runs on a port other than 80 and 443. Let’s say your web application is on some custom port 5000. Thus, to open it we use-

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

Just replace 5000 with whatever port number you want to open.

Third, in order to ensure that the open service or port is successfully recognized by the firewalld, reload its service using the following command:

sudo firewall-cmd --reload

Block or close port 80 and 443 – If after some time, you want to block or close HTTP and HTTPS services or any other port, you can do so manually, using the following syntax:

sudo firewall-cmd --zone=public --permanent --remove-service=http
sudo firewall-cmd --zone=public --permanent --remove-service=https

For some particular port number

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

Reload firewall

firewall-cmd --reload
Wrapping it Up

Configuring firewalls to allow HTTP and HTTPS traffic is a vital step for ensuring smooth and secure web service operations on AlmaLinux and Rocky Linux 8. By enabling ports 80 and 443, you can effectively serve web content and provide secure communication to your users. Tools like firewalld simplify this process, making it easy to manage access while maintaining system security.

Whether you’re deploying websites or hosting APIs, understanding how to manage firewall rules is an essential skill for administrators. With a properly configured firewall, you not only enable seamless connectivity but also ensure that your server remains safeguarded from unauthorized access.

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.