进入tomcat安装目录下的conf目录,然后编辑service.xml文件
在这里插入图片描述
输入:/8080,快速搜索默认端口的位置,然后将其修改80端口
在这里插入图片描述
wq保存退出

[root@mChenys conf]# ../bin/shutdown.sh 
[root@mChenys conf]# ../bin/shutdown.sh 

关闭,重启tomcat

最后还需要在linux上开放80端口

[root@mChenys conf]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
[root@mChenys conf]# /etc/rc.d/init.d/iptables save

在这里插入图片描述
至此完成配置.

介绍另一种方式,就是在Linux上配置nat,将80端口映射(转发)到8080端口上.
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
前提是8080端口也要事先开启

Logo

更多推荐