将端口80从服务器上的8080转发到8080,可以阻止8080端口的用户访问我的网站吗?

编程入门 行业动态 更新时间:2024-10-26 06:29:22
本文介绍了将端口80从服务器上的8080转发到8080,可以阻止8080端口的用户访问我的网站吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个运行在端口8080上的tomcat的Web应用程序.需要从非常严格的防火墙后面访问该应用程序.将端口80转发到8080是否允许防火墙后面的用户阻止8080访问应用程序?

I have a web application running on tomcat at port 8080. The application needs to be accessible from behind a very strict firewall. Will forwarding port 80 to 8080 allow users behind the firewall blocking 8080 to access the application?

如果没有,我还有什么其他选择?

If not, what other options do I have?

我按照以下说明进行端口转发

第1步:查看当前的防火墙规则

Step 1: View current firewall rules

sudo ipfw show

第2步:添加端口转发规则(从80到8080)

Step 2: Add port forwarding rule (80 to 8080)

运行Tomcat的默认端口是8080,因此在这里我们显示了将端口从端口80转发到8080(Tomcat的默认端口)的命令.显然,这也适用于其他端口,您只需要相应地调整命令即可.

The default port that Tomcat runs on is 8080, so here we show the command to do port fowarding from port 80 to 8080 (Tomcat’s default port). Obviously, this works for other ports as well, and you’d just have to adjust the command accordingly.

sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in

这是一个临时更改,重新启动后将还原.如果要使其永久存在,可以为其创建劳克恶魔.

This is a temporary change, and it will revert once you reboot. If you want to make it permanent, you can create a lauch deamon for it.

可选的删除规则

如果要删除防火墙规则,请运行:

If you want to remove your firewall rules run:

sudo ipfw flush

推荐答案

是的,因为转发是在您的计算机上完成的,因此看起来就像在端口80上一样.工作正常.

Yes it will work, since the forwarding is done on your machine it looks to the outside as if it were on port 80. We had a similar set up and it worked fine.

当然,如果防火墙非常严格,它们可能还有其他可能会干扰的阻止规则(也许它们仅允许某些IP通过).

Of course if the firewall is very strict they might have other blocking rules that could interfere (perhaps they only allow certain IPs through).

更多推荐

将端口80从服务器上的8080转发到8080,可以阻止8080端口的用户访问我的网站吗?

本文发布于:2023-10-07 12:43:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469415.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:端口   器上   用户   网站

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!