-2

I am working with a CentOS VPS and would like to achieve this without running tomcat as root.

3 Answers 3

1

you have two options:

  • Put an apache or other webserver in front of the tomcat server and pass the requests to the tomcat. This post shows how.
  • Using iptables redirects.

Nearly the same question is discussed here

0

for iptables redirect you can do like this :

iptables -t nat -A PREROUTING  -p tcp --dport 80 -j REDIRECT --to-port 8080
0

For CentOS 7, use this:

sudo firewall-cmd --zone=trusted --add-forward-port=port=80:proto=tcp:toport=8080 --permanent
sudo reboot
2
  • You shouldn't need to reboot to apply firewall changes. Can you suggest a more appropriate command to do so?
    – Paul Gear
    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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .