The web server on VPS requires port settings to provide access to the web. The port required to be opened on iptables is port 80 (http) and port 443 (https). There are two ways to set this:
1. By editing on /etc/sysconfig/iptables/ as on the following command:
- First, open a file or type a vi /etc/sysconfig/iptables command
- Next, please edit in the given bold line
:IN_public_log - [0:0]
:OUTPUT_direct - [0:0]
-A INPUT -p udp -m udp --dport 10050 -j ACCEPT
-A INPUT -p udp -m udp --dport 10050 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -m connectrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -j INPUT_direct
-A INPUT -j INPUT_ZONES_SOURCE
-A INPUT -j INPUT_ZONES
- If it works, it'll produce something like this:
2. Opening port by typing command
- You can also use command on the terminal with the following commands
iptables -A INPUT -p tcp -m tcp ▪dp
You can also use command on the terminal with the following commands
iptables -A INPUT -p tcp -m tcp ▪dport 443 -j ACCEPT
iptables -I INPUT -m state --state ESTABLISHED,RATED -j ACCEPT
- Next, save the iptables changes with the command
Service iptables save
- If you manage to save it, it will produce something like this.
- Then, please do a set iptables check with command
iptables -nvL\
- If successful it will show like this
- If so, please do a check by opening the web which is placed on the server via browser
Click here to see more information about the Virtual Private Cloud on Linux