One of the problems recently encountered in the development project was the publication of a Web project in Tomcat, but after the publication was successful, only Http://localhost:8080/aml access to the project was possible, and the project could not be accessed with Http://172.0.0.1:8080/aml. Nor can it be accessed with a local IP address, while other colleagues ' computers are inaccessible.
It was initially thought to be a firewall problem, but after shutting down the firewall, it was still inaccessible. At the same time, it is not allowed to turn off remote access. Later, when viewing the information, I know that Tomcat bound IP address problem, and Win7 by default is the IPv6 protocol, ping localhost to see what the IP format, learned: 1 IPv6.
First Solution:
1: Start tomcat, use the cmd command: D:\tomcat\bin>netstat-an | findstr "8080" to view the Tomcat address bindings.
2: Configure Tomcat's server.xml, change the connector configuration, the port does not change, add address= "0.0.0.0", bind it to IPv4. The configuration is as follows:
1 < port= "8080" address= "0.0.0.0" protocol= "http/1.1"2 ConnectionTimeout = "20000" 3 redirectport= "8443"/>
3: Restart Tomcat to view the Tomcat address bindings again. found that the binding address has become the 0.0.0.0:8080,IPV4 protocol.
In addition, the Address property's modification allows Tomcat to bind the specified IP, such as: address= "127.0.0.1", so Tomcat listens only to port 8080 of the IP address 127.0.0.1. (By default, it listens for all IPs.) )
When Tomcat publishes a project, localhost can access it with an IP address that is inaccessible to other computers.