I've tried for some hours to do this simple job, but it is not so simple like you think.
I wanted to redirect every request for 443 and 80 port to a webserver , in my example http://127.0.0.1:80
Port 80 worked without any problems, but 443 port tried me a lot of time...
I guess you've tried already to run the following command:
iptables -t nat -A OUTPUT -p tcp -m tcp --dport 443 -j DNAT --to-destination 127.0.0.1:80
But this is wrong, because the port 443 cannot be redirected to other ports than 443.
Use the following command:
iptables -t nat -A OUTPUT -p tcp --dport 443 -j DNAT --to-destination 127.0.0.1:443
Then enable https for apache.
If you are using CentOS use this tutorial - http://wiki.centos.org/HowTos/Https
Good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With