Port forwarding
Port forwarding
Port forwarding using iptables
Use iptables for redirects
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
if you need to use localhost also add this
iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 8080