Warning: This is a personal note that may be difficult to understand.
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 4000