The post AlmaLinux / Rocky Linux 8 Open HTTP/HTTPS Port 80/443 with Firewalld first appeared on Web Hosting Stuff.
]]>As RHEL-compatible distributions, both AlmaLinux and Rocky Linux 8 come with `firewalld` as their default firewall management tool. This powerful firewall solution helps protect your server while allowing necessary services to function smoothly. However, for your web server to be accessible to the outside world, you’ll need to explicitly configure these ports.
Whether you’re a seasoned system administrator or just getting started with Linux server management, this tutorial will help you secure your web server while maintaining its accessibility.
FirewallD includes the default firewall application in these Linux results to follow the commands mentioned below if you have it:
sudo dnf install firewalld
sudo systemctl start firewalld
sudo systemctl enable firewalld
sudo systemctl status firewalld
This tutorial will help you to learn:
Check Commands to open or close HTTP port 80 & HTTPS 443 on AlmaLinux/ Rocky 8
Step 1: Monitor the running AlmaLinux port list: Before opening the port, it’s necessary to monitor what are ports & services are being used before communicating outside the public network in our firewall. To access this, use:
sudo firewall-cmd --list-all
Or
netstat -na | grep port-number
Now, you have to replace the port number with the one you want to identify. In case the port is inactive, then you are not able to get the results in return.
Step 2: Command to Open port 80 and port 443: It is universal that a firewall includes some default pre-configured services, and HTTP & HTTPS as well. Therefore, we can either include the service command or the port command of the firewalld to permit them in the public zone:
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --zone=public --permanent --add-service=https
However, if the Apache web server’s application is running on some other port apart from 80 & 443, then we can open that also. Let’s assume your web application is running on some custom port 5000. Thus, to access it, we can use it:
sudo firewall-cmd --zone=public --permanent --add-port 5000/tcp
You have to replace 5000 with your wish port number, which you want to open
Step 3: Reload Firewalld service- Just make sure that the open service or port successfully matches the firewalld, reload its services by this command –
sudo firewall-cmd –reload
(optional) Close or block port 80 and 443 – After some time or in some cases, you want to block or close the HTTP and HTTPS services or any other port, then you can do it manually, using the syntax below:
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
For Reloading the firewall –
firewall-cmd –reload
To open HTTP and HTTPS ports 80 and 443 on AlmaLinux or Rocky Linux 8 using Firewalld, one must configure the firewall settings to allow traffic through these essential ports, thereby enabling web services to function properly. This process is crucial for ensuring that web applications are accessible over the internet.
The post AlmaLinux / Rocky Linux 8 Open HTTP/HTTPS Port 80/443 with Firewalld first appeared on Web Hosting Stuff.
]]>