[ec2-user@ip-172-31-32-84 ~]$ sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8443

[ec2-user@ip-172-31-32-84 ~]$ sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8443

[ec2-user@ip-172-31-32-84 ~]$ sudo iptables -t nat -L --line-numbers

Chain PREROUTING (policy ACCEPT)

num  target     prot opt source               destination

1    REDIRECT   tcp  --  anywhere             anywhere             tcp dpt:https redir ports 8443

2    REDIRECT   tcp  --  anywhere             anywhere             tcp dpt:http redir ports 8443


Chain INPUT (policy ACCEPT)

num  target     prot opt source               destination


Chain OUTPUT (policy ACCEPT)

num  target     prot opt source               destination


Chain POSTROUTING (policy ACCEPT)

num  target     prot opt source               destination

[ec2-user@ip-172-31-32-84 ~]$ sudo service iptables save

iptables: Saving firewall rules to /etc/sysconfig/iptables: [  OK  ]

iptables 데몬도 돌고 있는데 왜 꼭 포트를 붙여줘야만 접속이 되냐고;;