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:
First, run the following command to add the TCP service to port 80 permanently:
Now, let’s add the HTTP and HTTPS services one by one through the following commands:
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:
Finally, run the following command to display that TCP is now working on port 80:
Moreover, you can also use the following command to list all the available information from the Firewall:
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 --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.