This article describes how to configure your
iptables software firewall to allow web traffic on port 80 (HTTP) and port 443 (HTTPS).
iptables is the default software firewall for RHEL® 6-based distributions.
You need to have the following prerequisites:
- Basic understanding of Secure Shell (SSH)
- Sudo or administrative access to your server
- A cloud server with RHEL 6 or CentOS® 6 running
These steps are only for non-RackConnected Cloud servers. If you are using RackConnect, you can make these changes on your dedicated firewall.
Log in to your server by using SSH and then complete the steps in the following sections for your preferred setup method.
Use the following one-line command to open the open the firewall ports:
sudo sh -c "iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT && iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT && service iptables save"
If you prefer to configure the software firewall by using discrete steps instead of by using the one-line command, perform the following steps:
Run the following command to allow traffic on port 80:
sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
Run the following command to allow traffic on port 443:
sudo iptables -I INPUT -p tcp -m tcp --dport 443 -j ACCEPT
Run the following command to save the
sudo service iptables save
After you complete the preceding steps, you have configured your server to allow HTTP and HTTPS web traffic through your
iptables software firewall. If you've configured your website to accept traffic on ports 80 and 443, you should be able to visit both the HTTP and HTTPS versions of your website.
Updated 3 months ago