How to Open Ports in Firewalld on AlmaLinux (Step-by-Step Guide)

  • Home
  • VPS Hosting
  • How to Open Ports in Firewalld on AlmaLinux (Step-by-Step Guide)

Can’t Connect to Your Application? Check the Firewall.

AlmaLinux has become the go-to Enterprise Linux distribution for VPS hosting, replacing CentOS. It comes with a robust firewall management tool called firewalld enabled by default.

While this is great for security, it often causes confusion for new server owners. You might install a web server (Nginx/Apache) or a game server, only to find that you can’t connect. The reason? You need to explicitly allow traffic through specific ports.

Need a Secure & Ready-to-Use VPS?
Get an AlmaLinux VPS instantly deployed with full root access. Perfect for hosting apps and websites.
Deploy AlmaLinux VPS Now

Step 1: Check Firewall Status

Before making changes, verify that the firewall is running. Log in via SSH and run:

systemctl status firewalld

If it says active (running), you are ready to proceed.

Step 2: Allow a Specific Port (Temporary)

To open a port (for example, port 80 for HTTP traffic) immediately, use the firewall-cmd tool:

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

Note: This change will be lost if you reboot the server. It is good for testing.

Step 3: Make the Rule Permanent

Once you confirmed that everything works, you must make the rule permanent so it survives server reboots. Add the --permanent flag:

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

You can also open a range of ports (useful for passive FTP or game servers):

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

Step 4: Reload the Firewall (Crucial!)

For the permanent changes to take effect, you must reload the configuration:

sudo firewall-cmd --reload

Step 5: Verify Open Ports

To see a list of all currently open ports and services, run:

sudo firewall-cmd --list-all

Conclusion

Understanding firewalld is essential for any Linux administrator. It ensures your WPressly VPS remains secure while allowing necessary traffic for your applications.

Looking for reliable hosting options?