如何配置tomcat绑定到单个IP地址(localhost)而不是所有地址?

ScA*_*er2 75 tomcat

如何配置tomcat绑定到单个IP地址(localhost)而不是所有地址?

ScA*_*er2 130

配置了多个连接器,每个连接器都有一个可选的"地址"属性,您可以在其中设置IP地址.

  1. 编辑tomcat/conf/server.xml.
  2. 指定该连接器的绑定地址:
    <Connector 
        port="8080" 
        protocol="HTTP/1.1" 
        address="127.0.0.1"
        connectionTimeout="20000" 
        redirectPort="8443" 
      />
    

  • 除了将 **bind(2)** 绑定到单个地址之外,您还可以使用多个 `Connector` 元素绑定到更多地址。https://access.redhat.com/solutions/873953 (2认同)

rng*_*lbd 11

这里有很好的记录:

http://wiki.apache.org/tomcat/FAQ/Connectors#Q6

如何绑定到特定的IP地址?- "每个Connector元素允许地址属性.请参阅HTTP连接器文档或AJP连接器文档".和HTTP连接器文档:

http://tomcat.apache.org/tomcat-7.0-doc/config/http.html

标准实施 - >地址

"对于具有多个IP地址的服务器,此属性指定将在指定端口上侦听哪个地址.默认情况下,此端口将用于与服务器关联的所有IP地址."