I am working with a CentOS VPS and would like to achieve this without running tomcat as root.
3 Answers
for iptables redirect you can do like this :
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
For CentOS 7, use this:
sudo firewall-cmd --zone=trusted --add-forward-port=port=80:proto=tcp:toport=8080 --permanent
sudo reboot
-
You shouldn't need to reboot to apply firewall changes. Can you suggest a more appropriate command to do so? Mar 7, 2019 at 22:50
-
just leave off the --permanent and it will take effect immediately, however it will not survive reboot. If you want to make it permenant (so it works after reboot) use the --permanent Mar 9, 2019 at 21:38