您的位置:首页 > 运维架构 > Tomcat

Redirect port 80 to port 8080 for Tomcat

2014-11-05 00:00 597 查看
摘要: By default Tomcat’s HTTP connector listens on port 8080. Changing to port 80 in Linux environment is a tricky issue, since by default listening on any port under 1024 require a privileged user, and for security considerations it is not recommended to run Tomcat with elevated permissions. We can u...

By default Tomcat’s HTTP connector listens on port 8080. Changing to port 80 in Linux environment is a tricky issue, since by default listening on any port under 1024 require a privileged user, and for security considerations it is not recommended to run Tomcat with elevated permissions. We can use iptables to achieve this.

# open 80 port
sudo iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
# open 8080 port
sudo iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
# redirect port 80 to port 8080
sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
# save iptables rules
sudo service iptables save
# make iptables auto start after reboot
sudo chkconfig --add iptables
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  tomcat
相关文章推荐