Ubuntu如何配置Tomcat访问80端口

说明:在Ubuntu上非root用户只能使用1024端口以上端口,即0-1023对非root用户为禁用状态。需要使用iptables的转发功能,把80端口(外部访问端口)消息转发给8080端口(目标端口)。
本文所述操作预期达成效果:Web访问地址不需要加端口号即可正常访问相关应用程序。

1)查看系统是否安装iptables防火墙。
#whereis iptables
iptables:/sbin/iptables/etc/iptables.rules/usr/share/iptables/usr/share/man/man8/iptables.8.gz

上述返回结果为已安装状态,按3)进行后续操作,否则按2)所述进行安装。

2)安装iptables防火墙。
#apt-get install iptables
3) 查看防火墙配置信息。
#iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
4) 配置防火墙访问控制规则。

创建iptables.rules文件:

#vim /etc/iptables.rules

添加下列内容:

*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:syn-flood - [0:0]
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值