Rocky Linux

How to Open Port 80 on Rocky Linux 9

Port 80 is the standard port of an operating system which is used to transmit the HTTP traffic on the web (internet). It is the default network port to send or receive the unencrypted web pages. A Kernal’s network stack manages the ports and binds them to listen for the incoming connection. Additionally, port 80 can be used for different types of traffic, including Secure Sockets Layer encrypted HTTPS, which uses port 443.

The Apache web server, listens on port 80 by default to respond to the web page request from the user. However, you need to open port 80 for various reasons including hosting the website, running the web server, testing the network connectivity, and many more. I you are a Rocky Linux user and you want to know how to open port 80, this guide is for you.

How to Open Port 80 on Rocky Linux 9

Let’s take an example to open port 80 for the HTTP service. Originally, the HTTP protocol was developed to run on the TCP transport layer. This layer provides great, reliable, connection-oriented communication.

HTTP relies on the TCP to offer various features including flow, data retransmission, error connections, etc. Hence, if you run an HTTP service on port 80, it is important to use TCP to ensure the connection between the client and server without any data loss. Let’s start opening port 80 for HTTP and TCP with the Firewall.

Before adding HTTP in port 80, check if the Firewall is running the system:

sudo systemctl status firewalld

First, run the following command to add the TCP service to port 80 permanently:

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

Now, let’s add the HTTP and HTTPS services one by one through the following commands:

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

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

Once you are done, it is essential to reload the Firewall services to make the changes successful:

sudo firewall-cmd --reload

Finally, run the following command to display that TCP is now working on port 80:

sudo firewall-cmd --list-ports

Moreover, you can also use the following command to list all the available information from the Firewall:

sudo firewall-cmd --list-all

Remember, opening port 80 in the system can lead to security risks and privacy issues. Therefore, configure it correctly for your web servers to ensure security.

How to Disable/Close Port 80 in Linux

If you want to remove the services from port 80, run the following commands one by one:

sudo firewall-cmd --remove-port=80/tcp --permanent

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

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

Conclusion

This is how you can easily open port 80 on Rocky Linux 9. We recommend that you configure everything after opening port 80, or it can lead to serious privacy and security issues. Furthermore, we also explained the simple commands that you can use to disable/close port 80, including its service. Although you use the iptables command to open and set port 80, it sometimes shows errors in Rocky Linux 9. This is why we only explained the Firewall option.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.