为什么Tomcat使用端口8080而不是80?

时间:2021-05-29 18:11:07

I have started and tested Tomcat under Port 8080 (default). Now I altered the connector port to 80 and restarted Tomcat, nothing will show on my minimal Debian 6.0 installation. Now where is the trick here?

我已经在端口8080下启动并测试了Tomcat(默认)。现在我将连接器端口更改为80并重新启动Tomcat,在我的最小Debian 6.0安装中不会显示任何内容。现在这里的诀窍在哪里?

<Connector port="80" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           URIEncoding="UTF-8"
           redirectPort="8443" />

7 个解决方案

#1


31  

go to /etc/default/tomcat6 and change #AUTHBIND=no to AUTHBIND=yes

转到/ etc / default / tomcat6并将#AUTHBIND = no更改为AUTHBIND = yes

 # If you run Tomcat on port numbers that are all higher than 1023, then you
 # do not need authbind.  It is used for binding Tomcat to lower port numbers.
 # NOTE: authbind works only with IPv4.  Do not enable it when using IPv6.
 # (yes/no, default: no)
 #AUTHBIND=no

#2


11  

Two typical reasons:

两个典型的原因:

  • You quite possibly don't have permission to listen to a port lower than 1024 (usually requires administrative privileges, e.g. being root)
  • 您很可能没有权限侦听低于1024的端口(通常需要管理权限,例如root)
  • Something else may already be listening on port 80 (e.g. apache)
  • 其他东西可能已经在端口80上监听(例如apache)

#3


9  

Did you start Tomcat on port 80 as root? You have to be root to bind to ports <= 1024 in Linux.

你是否以root身份在端口80上启动Tomcat?您必须是root才能绑定到Linux中的端口<= 1024。

#4


8  

If nothing of the commented before works (like it happened to me), you can direct the traffic from the port 80 to the 8080.

如果之前没有任何评论(就像它发生在我身上),你可以将流量从端口80引导到8080。

To do it:

去做吧:

http://forum.slicehost.com/index.php?p=/discussion/2497/iptables-redirect-port-80-to-port-8080/p1

http://forum.slicehost.com/index.php?p=/discussion/2497/iptables-redirect-port-80-to-port-8080/p1

In a nutshell, type this three commands in a terminal:

简而言之,在终端中键入以下三个命令:

$ sudo iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
$ sudo iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
$ sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 

#5


2  

Run your startup script as root after changing the binding.

更改绑定后,以root用户身份运行启动脚本。

sudo ./<path to tomcat bin director>/startup.sh

#6


0  

stop apache service and then run tomcat you should be good , by default apache is running on port 80

停止apache服务,然后运行tomcat你应该是好的,默认情况下apache在端口80上运行

#7


0  

You can use authbind/privbind or capabilities to bind to port 80.

您可以使用authbind / privbind或功能绑定到端口80。

#1


31  

go to /etc/default/tomcat6 and change #AUTHBIND=no to AUTHBIND=yes

转到/ etc / default / tomcat6并将#AUTHBIND = no更改为AUTHBIND = yes

 # If you run Tomcat on port numbers that are all higher than 1023, then you
 # do not need authbind.  It is used for binding Tomcat to lower port numbers.
 # NOTE: authbind works only with IPv4.  Do not enable it when using IPv6.
 # (yes/no, default: no)
 #AUTHBIND=no

#2


11  

Two typical reasons:

两个典型的原因:

  • You quite possibly don't have permission to listen to a port lower than 1024 (usually requires administrative privileges, e.g. being root)
  • 您很可能没有权限侦听低于1024的端口(通常需要管理权限,例如root)
  • Something else may already be listening on port 80 (e.g. apache)
  • 其他东西可能已经在端口80上监听(例如apache)

#3


9  

Did you start Tomcat on port 80 as root? You have to be root to bind to ports <= 1024 in Linux.

你是否以root身份在端口80上启动Tomcat?您必须是root才能绑定到Linux中的端口<= 1024。

#4


8  

If nothing of the commented before works (like it happened to me), you can direct the traffic from the port 80 to the 8080.

如果之前没有任何评论(就像它发生在我身上),你可以将流量从端口80引导到8080。

To do it:

去做吧:

http://forum.slicehost.com/index.php?p=/discussion/2497/iptables-redirect-port-80-to-port-8080/p1

http://forum.slicehost.com/index.php?p=/discussion/2497/iptables-redirect-port-80-to-port-8080/p1

In a nutshell, type this three commands in a terminal:

简而言之,在终端中键入以下三个命令:

$ sudo iptables -A INPUT -i eth0 -p tcp --dport 80 -j ACCEPT
$ sudo iptables -A INPUT -i eth0 -p tcp --dport 8080 -j ACCEPT
$ sudo iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080 

#5


2  

Run your startup script as root after changing the binding.

更改绑定后,以root用户身份运行启动脚本。

sudo ./<path to tomcat bin director>/startup.sh

#6


0  

stop apache service and then run tomcat you should be good , by default apache is running on port 80

停止apache服务,然后运行tomcat你应该是好的,默认情况下apache在端口80上运行

#7


0  

You can use authbind/privbind or capabilities to bind to port 80.

您可以使用authbind / privbind或功能绑定到端口80。